- Hands-On Object:Oriented Programming with C#
- Raihan Taher
- 110字
- 2021-07-02 12:44:35
If-else construct
The most commonly used conditional statement is the if-else construct. The building block of the if-else structure contains an if keyword, followed by a Boolean expression and a set of curly brackets to specify the steps to execute. Optionally, there could be an else keyword, followed by curly brackets for the code to execute when the if block is false:
int a = 5;
if (a == 5)
{
// As a is 5, do something
}
else
{
// As a is not 5, do something
}
The if-else construct can also have an else-if statement to specify multiple criteria for execution.
推薦閱讀
- Java逍遙游記
- Android Application Development Cookbook(Second Edition)
- C語言程序設計教程(第2版)
- 高級C/C++編譯技術(典藏版)
- Spring+Spring MVC+MyBatis整合開發實戰
- 移動界面(Web/App)Photoshop UI設計十全大補
- OpenCV 4計算機視覺項目實戰(原書第2版)
- Building Android UIs with Custom Views
- Spring Boot實戰
- JSP程序設計實例教程(第2版)
- C++語言程序設計
- R語言:邁向大數據之路(加強版)
- WildFly Cookbook
- Android 游戲開發大全(第二版)
- 軟硬件綜合系統軟件需求建模及可靠性綜合試驗、分析、評價技術