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

Continue

This is used to invoke the next iteration. The contextual keyword allows the developer to continue to the next step without executing any further code in the block.

Now, let's look at how we can use both of these contextual statements in our program:

var x = 0;
while(x<=10)
{
x++;
if(x == 2)continue;
Console.WriteLine(x);
if(x == 5) break;
Console.WriteLine("End of loop body");
}
Console.WriteLine($"End of loop, X : {x}");

The preceding code will skip execution of the body for the iteration value, 2, because of the continue statement. The loop will execute until the value of x is 5 because of the break statement.

主站蜘蛛池模板: 虞城县| 博白县| 钟祥市| 甘洛县| 方山县| 宿迁市| 肃北| 松江区| 湖北省| 天门市| 三穗县| 姚安县| 红河县| 白朗县| 慈利县| 泰兴市| 文安县| 集贤县| 海城市| 漳州市| 祁连县| 汉中市| 库尔勒市| 搜索| 旬邑县| 宜州市| 永吉县| 涞源县| 洪江市| 芜湖县| 库伦旗| 康乐县| 新乡县| 海兴县| 金溪县| 信阳市| 和田县| 汕尾市| 泊头市| 什邡市| 棋牌|