1 Star 3 Fork 0

Tony Silver / easygolang

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ch-29.go 490 Bytes
一键复制 编辑 原始数据 按行查看 历史
Lmu_Xuzl 提交于 2019-01-11 23:46 . go语言流程控制语句结束
package main
import "fmt"
/**
goto语句
goto语句可以无条件跳转到相同函数中的带标签语句
*/
func main() {
//GG: //GG标签如果放到for 前面会一直死循环,因为goto一直在跳转
// fmt.Println("goto stop")
// hello()
for i:=0;i<10;i++ {
fmt.Println(i)
if i==5 {
goto GG
}
}
GG: //GG标签如果放到for 前面会一直死循环,因为goto一直在跳转
fmt.Println("goto stop")
hello()
}
func hello() {
fmt.Println("hello world")
}
Go
1
https://gitee.com/tonysilver/easygolang.git
git@gitee.com:tonysilver/easygolang.git
tonysilver
easygolang
easygolang
master

搜索帮助