Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于goto的错误 #6

Open
cha0ran opened this issue Mar 21, 2022 · 0 comments
Open

关于goto的错误 #6

cha0ran opened this issue Mar 21, 2022 · 0 comments

Comments

@cha0ran
Copy link

cha0ran commented Mar 21, 2022

package main
import "fmt"
func main() {
	num := 1
	if(num <= 10){
		fmt.Println(num)
		num++
		goto outer // 死循环
	}
outer:
	fmt.Println("come here")
}

这仅仅是个if判断,也没有无限循环,且goto标记位于语句块之外的结尾处,即使循环也只执行一次,为什么要注释为死循环呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant