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

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.

主站蜘蛛池模板: 五河县| 马尔康县| 汾阳市| 林口县| 盐池县| 尚志市| 通渭县| 乾安县| 溆浦县| SHOW| 安泽县| 荣成市| 永善县| 昭苏县| 太原市| 莱芜市| 普宁市| 双辽市| 通城县| 班玛县| 磴口县| 万安县| 灌云县| 安远县| 诸暨市| 西丰县| 泉州市| 桐乡市| 卓资县| 天津市| 玛多县| 双峰县| 东山县| 保亭| 阿坝县| 巴东县| 浦东新区| 西充县| 岳池县| 克拉玛依市| 呼玛县|