官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 江永县| 榆林市| 嘉定区| 华坪县| 彰武县| 衢州市| 沂南县| 绍兴市| 浦东新区| 襄垣县| 奈曼旗| 观塘区| 潼关县| 邻水| 城口县| 四会市| 定兴县| 田阳县| 荣昌县| 昌江| 清水河县| 永靖县| 桐城市| 怀仁县| 龙井市| 青河县| 芦溪县| 东兴市| 时尚| 济南市| 泰来县| 鹤岗市| 江阴市| 宜宾市| 陈巴尔虎旗| 三亚市| 大新县| 远安县| 武隆县| 浦城县| 漠河县|