- 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.
推薦閱讀
- 大話PLC(輕松動漫版)
- 深度實踐OpenStack:基于Python的OpenStack組件開發
- Getting Started with ResearchKit
- C#編程入門指南(上下冊)
- Mastering Articulate Storyline
- Java Web及其框架技術
- Java深入解析:透析Java本質的36個話題
- Learning Data Mining with R
- Salesforce Reporting and Dashboards
- Android應用開發實戰
- 軟件體系結構
- FPGA嵌入式項目開發實戰
- SQL Server 入門很輕松(微課超值版)
- Visual C++從入門到精通(第2版)
- Learning Java by Building Android Games