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

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.

主站蜘蛛池模板: 乐安县| 富平县| 察哈| 武冈市| 浮梁县| 措美县| 陆川县| 宕昌县| 云安县| 安福县| 阿合奇县| 南靖县| 丹凤县| 鄂托克前旗| 西青区| 安丘市| 新蔡县| 梅州市| 易门县| 报价| 察雅县| 台山市| 湘潭市| 来安县| 夏河县| 忻城县| 南投市| 新和县| 阿拉善右旗| 大石桥市| 美姑县| 准格尔旗| 广丰县| 甘谷县| 金华市| 兰坪| 霸州市| 靖宇县| 乌兰浩特市| 宝山区| 武义县|