- Hands-On Object:Oriented Programming with C#
- Raihan Taher
- 107字
- 2021-07-02 12:44:36
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.
推薦閱讀
- AngularJS入門與進階
- Instant Testing with CasperJS
- 國際大學生程序設計競賽中山大學內部選拔真題解(二)
- TypeScript Blueprints
- Ext JS Data-driven Application Design
- Python零基礎快樂學習之旅(K12實戰訓練)
- STM32F0實戰:基于HAL庫開發
- QGIS:Becoming a GIS Power User
- 零基礎學單片機C語言程序設計
- Python High Performance Programming
- 利用Python進行數據分析
- HTML 5與CSS 3權威指南(第3版·上冊)
- Java Web開發詳解
- Django 3.0入門與實踐
- Hadoop 2.X HDFS源碼剖析