- Learn C# in 7 days
- Gaurav Aroraa
- 77字
- 2021-07-08 09:51:30
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.
推薦閱讀
- 深入淺出Java虛擬機:JVM原理與實戰
- 實用防銹油配方與制備200例
- 精通軟件性能測試與LoadRunner實戰(第2版)
- Ray分布式機器學習:利用Ray進行大模型的數據處理、訓練、推理和部署
- 軟件項目管理實用教程
- 青少年Python編程入門
- 深入淺出Serverless:技術原理與應用實踐
- Raspberry Pi Robotic Projects(Third Edition)
- Java Web開發實例大全(基礎卷) (軟件工程師開發大系)
- Android應用程序設計
- Blender 3D Cookbook
- Learning RSLogix 5000 Programming
- Salt Cookbook
- C語言從入門到精通(第4版)
- Comprehensive Ruby Programming