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

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.

主站蜘蛛池模板: 育儿| 安陆市| 丹东市| 宁南县| 宁波市| 如东县| 塔城市| 班戈县| 平顶山市| 广宁县| 许昌县| 怀安县| 万山特区| 佳木斯市| 噶尔县| 紫金县| 塔城市| 雷州市| 互助| 潜江市| 明水县| 罗江县| 新闻| 蓝山县| 新闻| 改则县| 筠连县| 兰州市| 德令哈市| 本溪| 柳林县| 隆尧县| 永福县| 江津市| 绵竹市| 郸城县| 新乡县| 连云港市| 苗栗市| 泽库县| 九龙坡区|