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

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.

主站蜘蛛池模板: 周口市| 宜章县| 准格尔旗| 杂多县| 桐乡市| 湘阴县| 商丘市| 霍山县| 通化市| 交城县| 林芝县| 万安县| 盘山县| 浪卡子县| 监利县| 游戏| 邵东县| 任丘市| 长春市| 蓬安县| 垦利县| 西藏| 天等县| 城固县| 托克托县| 江永县| 绵竹市| 土默特左旗| 吴忠市| 花莲市| 东城区| 太仆寺旗| 新泰市| 巨鹿县| 都昌县| 利川市| 增城市| 浙江省| 新沂市| 固阳县| 崇明县|