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

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.

主站蜘蛛池模板: 蛟河市| 厦门市| 镶黄旗| 神木县| 金寨县| 秭归县| 北流市| 兴安县| 隆安县| 彭山县| 沈丘县| 泰顺县| 承德县| 温宿县| 措美县| 周口市| 涿州市| 贡觉县| 汕尾市| 镇平县| 霸州市| 怀化市| 浑源县| 稻城县| 牡丹江市| 武宁县| 岗巴县| 云梦县| 昭觉县| 酒泉市| 江城| 池州市| 德阳市| 长子县| 饶阳县| 定襄县| 七台河市| 龙川县| 星子县| 溧阳市| 宾川县|