首页 > 其他 > 详细

go语音基础之goto的用法

时间:2018-12-31 18:31:03      阅读:244      评论:0      收藏:0      [点我收藏+]

1、goto的用法

示例:

package main //必须有一个main包

import "fmt"

func main() {

	//break //break is not in a loop, switch, or select
	//continue//continue is not in a loop

	//goto可以用在任何地方,但是不能夸函数使用
	fmt.Println("11111111111111")

    //go to的作用是跳转,中间的语句不执行,无条件跳转
	goto End //goto是关键字, End是用户起的名字, 他叫标签

	fmt.Println("222222222222222")

End:
	fmt.Println("3333333333333")

}

#执行结果:

11111111111111
3333333333333

  

 

go语音基础之goto的用法

原文:https://www.cnblogs.com/nulige/p/10202404.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!