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

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.

主站蜘蛛池模板: 固始县| 华亭县| 绵竹市| 弥勒县| 横峰县| 三河市| 安义县| 甘德县| 视频| 金溪县| 澜沧| 桐柏县| 读书| 四川省| 洛阳市| 西吉县| 海阳市| 紫阳县| 清新县| 隆德县| 大兴区| 昌图县| 卫辉市| 金阳县| 静乐县| 闽侯县| 隆昌县| 宜宾县| 图片| 工布江达县| 栾川县| 商水县| 仙桃市| 宝山区| 咸宁市| 鹰潭市| 佳木斯市| 麻栗坡县| 白河县| 兴城市| 奇台县|