- Security with Go
- John Daniel Leon
- 65字
- 2021-06-30 19:06:49
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")
}