- 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.
推薦閱讀
- LabVIEW 2018 虛擬儀器程序設計
- 體驗設計原理:行為、情感和細節
- 深入淺出Android Jetpack
- Learning Python Design Patterns(Second Edition)
- 用Flutter極速構建原生應用
- 編譯系統透視:圖解編譯原理
- Julia高性能科學計算(第2版)
- Spring MVC+MyBatis開發從入門到項目實踐(超值版)
- Hands-On Nuxt.js Web Development
- Puppet:Mastering Infrastructure Automation
- After Effects CC案例設計與經典插件(視頻教學版)
- 你好!Java
- SAS編程演義
- RESTful Web API Design with Node.js
- MATLAB/Simulink建模與仿真