Golang中的标签:label

package main

import "fmt"

func main() {
    var a int = 10 // 定义局部变量

    // 循环
LOOP:
    for a < 20 {
        if a == 15 {
            // 跳过迭代
            a++
            goto LOOP
        }
        fmt.Printf("a的值为 : %d\n", a)
        a++
    }
}

运行结果看
https://wide.b3log.org/playground/1da16604b64018b508cafbfd8af0fa36.go


参考:

https://studygolang.com/articles/12906
https://www.kancloud.cn/liupengjie/go/570042
https://medium.com/golangspec/labels-in-go-4ffd81932339

你可能感兴趣的:(Golang中的标签:label)