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