mirror of
https://gitee.com/shikong-sk/golang-study
synced 2025-02-23 15:32:15 +08:00
docs: goto
This commit is contained in:
parent
cc72858428
commit
09b8b7c18a
17
base/goto/main.go
Normal file
17
base/goto/main.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
if i == 5 {
|
||||||
|
// 跳转到指定标签
|
||||||
|
goto endTag
|
||||||
|
}
|
||||||
|
fmt.Println(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标签
|
||||||
|
endTag:
|
||||||
|
fmt.Println("结束")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user