- 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.
推薦閱讀
- 大話PLC(輕松動(dòng)漫版)
- Getting Started with Citrix XenApp? 7.6
- iOS Game Programming Cookbook
- 深入理解Android(卷I)
- The Supervised Learning Workshop
- JavaScript高效圖形編程
- 程序員面試算法寶典
- Hadoop+Spark大數(shù)據(jù)分析實(shí)戰(zhàn)
- Python Geospatial Development(Second Edition)
- Lua程序設(shè)計(jì)(第4版)
- 人人都是網(wǎng)站分析師:從分析師的視角理解網(wǎng)站和解讀數(shù)據(jù)
- RSpec Essentials
- Java編程從入門(mén)到精通
- Java Web從入門(mén)到精通(第2版)
- 現(xiàn)代CPU性能分析與優(yōu)化