猿问

Return: 在 Go 中意味着什么

我遇到了这样的功能(为清楚起见进行了简化):


func myfunc(ir io.RuneReader, ib []byte, is string, pos, ncap int, dstCap []int) []int {

var matched bool

// do something to get matched, change dstCap

Return:

    if !matched {

        return nil

    }

    return dstCap

}

'Return:' 行是什么意思?


眼眸繁星
浏览 139回答 1
1回答

SMILET

它是一个标签。它可以用作goto、break或continue语句的目标。
随时随地看视频慕课网APP

相关分类

Go
我要回答