
上QQ阅读APP看书,第一时间看更新
goto
Go does have a goto statement, but it is very rarely used. Create a label with a name and a colon, then go to it using the goto keyword. Here is a basic example:
package main
import "fmt"
func main() {
goto customLabel
// Will never get executed because
// the goto statement will jump right
// past this line
fmt.Println("Hello")
customLabel:
fmt.Println("World")
}