- 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.
推薦閱讀
- Mobile Web Performance Optimization
- C++程序設計(第3版)
- LabVIEW入門與實戰開發100例
- Manga Studio Ex 5 Cookbook
- C# Programming Cookbook
- C語言程序設計
- Mastering OpenCV 4
- 軟件項目管理實用教程
- HDInsight Essentials(Second Edition)
- R Data Analysis Cookbook(Second Edition)
- 新一代SDN:VMware NSX 網絡原理與實踐
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- Backbone.js Testing
- Android嵌入式系統程序開發(基于Cortex-A8)
- AI輔助編程Python實戰:基于GitHub Copilot和ChatGPT