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

Switch-case construct

Switch-case, on the other hand, is almost similar to the if statement; in this statement, the cases will determine the execution step. In the case of switch, this always falls in a discrete set of values, and hence, those values can be set up:

int a = 5;
switch (a)
{
case 4:
// Do something;
break;
case 5:
// Do something;
break;
default:
// Do something;
break;
}

The switch case automatically picks the correct case statement, depending on the value, and executes the steps defined inside the block. A case need to be concluded with a break statement.

主站蜘蛛池模板: 绥德县| 珠海市| 瑞安市| 彭水| 灵石县| 锦州市| 公主岭市| 阿拉善左旗| 隆尧县| 修文县| 丽江市| 梅州市| 桓台县| 连山| 库伦旗| 长子县| 沙坪坝区| 玉门市| 邵阳市| 涞水县| 远安县| 玉门市| 卢龙县| 益阳市| 华容县| 浏阳市| 垦利县| 石棉县| 锡林郭勒盟| 衡东县| 常熟市| 沽源县| 潞西市| 剑河县| 集安市| 二手房| 长乐市| 娱乐| 昌邑市| 达孜县| 北安市|