- 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應用與實戰
- 云原生Spring實戰
- Scientific Computing with Scala
- Teaching with Google Classroom
- 西門子S7-200 SMART PLC編程從入門到實踐
- Clean Code in C#
- 零基礎學HTML+CSS
- Machine Learning for OpenCV
- Python大規模機器學習
- JavaScript前端開發基礎教程
- Python數據預處理技術與實踐
- Java編程指南:語法基礎、面向對象、函數式編程與項目實戰
- Learning TypeScript
- JavaScript Mobile Application Development
- Java編程動手學