- Hands-On Object:Oriented Programming with C#
- Raihan Taher
- 103字
- 2021-07-02 12:44:35
Switch-case construct
Switch-case, on the other hand, is almost similar to the if statement; in this statement, the cases will determine the execution step. In the case of switch, this always falls in a discrete set of values, and hence, those values can be set up:
int a = 5;
switch (a)
{
case 4:
// Do something;
break;
case 5:
// Do something;
break;
default:
// Do something;
break;
}
The switch case automatically picks the correct case statement, depending on the value, and executes the steps defined inside the block. A case need to be concluded with a break statement.
推薦閱讀
- Java語言程序設計
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Oracle Exadata性能優化
- CockroachDB權威指南
- PHP基礎案例教程
- Oracle Database In-Memory(架構與實踐)
- RTC程序設計:實時音視頻權威指南
- 基于差分進化的優化方法及應用
- 深度強化學習算法與實踐:基于PyTorch的實現
- 單片機C語言程序設計實訓100例
- C++從入門到精通(第5版)
- GameMaker Essentials
- Instant Zurb Foundation 4
- Test-Driven iOS Development with Swift
- Building Web and Mobile ArcGIS Server Applications with JavaScript(Second Edition)