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

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.

主站蜘蛛池模板: 合水县| 潞西市| 江华| 南召县| 嘉黎县| 巴马| 鄂托克前旗| 岱山县| 柳河县| 石嘴山市| 云龙县| 繁峙县| 阳新县| 白银市| 九寨沟县| 灵寿县| 河东区| 聊城市| 黄石市| 肃宁县| 凉山| 丹东市| 奎屯市| 武定县| 赣榆县| 呼玛县| 宁强县| 康乐县| 温州市| 忻州市| 枝江市| 武平县| 大方县| 贡嘎县| 漾濞| 独山县| 措勤县| 门源| 阿坝| 湄潭县| 京山县|