go-goto

goto

例子1

for i:=0;i<5;i++ {
		for j:=0;j<5;j++ {
			if j>3 {
				goto GOBREAK
			}
			fmt.Printf("current i=%d,j=%d \n",i,j)
		}
	}

	GOBREAK:
		fmt.Printf("goto end ---------------")

输出

current i=0,j=0
current i=0,j=1
current i=0,j=2
current i=0,j=3
goto end ---------------

猜你喜欢

转载自blog.csdn.net/kq1983/article/details/113137932