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

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.

主站蜘蛛池模板: 竹北市| 历史| 黄冈市| 金川县| 福安市| 建平县| 思南县| 罗山县| 瓦房店市| 平定县| 海林市| 乐昌市| 宝坻区| 新宁县| 遵义县| 芦溪县| 古田县| 河北省| 晋江市| 高雄市| 关岭| 永春县| 鄱阳县| 义马市| 五华县| 信宜市| 岫岩| 潼关县| 普安县| 河池市| 富宁县| 阳山县| 连江县| 云霄县| 衡水市| 涞源县| 拉孜县| 兴仁县| 五莲县| 隆德县| 太康县|