goto语句 在程序中我们可以给代码加上标签,这样就可以使用goto语句直接跳到标签的地方去执行goto语句的语法goto<1labelName>;标签定义<1labelName> 实例 1234567891011121314151617181920 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _18{ class { static void Main(string[] args) { int labal = 5; goto mylabe; labal++;//中间的代码就会被过滤掉,直接跳转到goto语句那 mylabe: Console.WriteLine(labal); Console.ReadKey(); } }} 赞微海报分享
近期评论