- 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.
推薦閱讀
- HTML5+CSS3+JavaScript從入門到精通:上冊(微課精編版·第2版)
- Oracle WebLogic Server 12c:First Look
- 從零開始:數字圖像處理的編程基礎與應用
- 數據庫系統教程(第2版)
- 企業級Java EE架構設計精深實踐
- 青少年美育趣味課堂:XMind思維導圖制作
- Magento 2 Development Cookbook
- Spring Cloud、Nginx高并發核心編程
- Visual Basic程序設計實驗指導(第4版)
- Python圖形化編程(微課版)
- Frank Kane's Taming Big Data with Apache Spark and Python
- PHP 7從零基礎到項目實戰
- 區塊鏈國產化實踐指南:基于Fabric 2.0
- Java 9 with JShell
- Mastering OpenStack