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

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.

主站蜘蛛池模板: 雅安市| 萝北县| 龙岩市| 玛纳斯县| 眉山市| 澎湖县| 全州县| 中江县| 重庆市| 会昌县| 六安市| 尚志市| 宝应县| 乌拉特后旗| 体育| 彭州市| 文水县| 吴江市| 定州市| 通海县| 潞西市| 沂源县| 石柱| 遂川县| 张家川| 蓬安县| 永宁县| 本溪| 富蕴县| 合水县| 宝坻区| 麦盖提县| 包头市| 苏州市| 常德市| 铜山县| 四川省| 万山特区| 小金县| 德清县| 德令哈市|