Golang Goto 语句

2025 年 4 月 1 日 | 1 分钟阅读

Go goto 语句是一个跳转语句,用于将控制权转移到程序的其他部分。

在 goto 语句中,必须有一个标签。我们使用标签来转移程序的控制权。

Go Goto 语句示例

输出

You are not eligible to vote 
Enter your age 15
You are not eligible to vote 
Enter your age 18
You can vote 
 
下一个主题Golang-break