官术网_书友最值得收藏!

break

This terminates the control flow for loop or in switch statement. Take a look at the following example:

private static void BreakStatementExample() 
{ 
WriteLine("break statement example"); 
WriteLine("break in for loop"); 
for (int count = 0; count < 50; count++ 
{ 
if (count == 8) 
   { 
    break; 
   } 
WriteLine($"{count}"); 
} 
WriteLine(); 
WriteLine("break in switch statement"); 
SwitchCaseExample(); 
} 

In the preceding code, execution of the for loop will break as soon as the if expression evaluates to true.

主站蜘蛛池模板: 北碚区| 剑河县| 酒泉市| 望城县| 临安市| 贵南县| 天台县| 格尔木市| 正安县| 巴林左旗| 大关县| 贺州市| 石家庄市| 石阡县| 太仆寺旗| 石首市| 靖州| 如皋市| 江口县| 罗甸县| 灵台县| 哈尔滨市| 从化市| 通化县| 陇川县| 阿克苏市| 西和县| 台南市| 元江| 平泉县| 沅陵县| 新和县| 同德县| 米林县| 南部县| 许昌县| 锡林浩特市| 东辽县| 堆龙德庆县| 米林县| 宿迁市|