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

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.

主站蜘蛛池模板: 大名县| 皮山县| 漳浦县| 武冈市| 开化县| 凤台县| 缙云县| 西城区| 嘉兴市| 吉林市| 苗栗县| 高阳县| 织金县| 南澳县| 寿阳县| 高陵县| 景德镇市| 梨树县| 抚远县| 灵山县| 竹北市| 宽城| 武定县| 永嘉县| 徐州市| 景德镇市| 安徽省| 交城县| 望奎县| 积石山| 广安市| 华阴市| 汉中市| 宁海县| 马公市| 若尔盖县| 周至县| 开封县| 沙坪坝区| 宜宾市| 扬州市|