0
what is switch
switch and break
4 Antworten
+ 4
switch is a multi way branching statements where based on the condition the control can be transferred to many cases unlike if statement where the action is taken based on the condition(i.e. if is a two way branching statements). break statement is not mandatory in switch but if it is not used all the remaining cases below the desired case will be executed and to prevent this happen we use break statement....
+ 1
switch is a decision making choice based statement.
0
Um ok I cant write a good advice :P
- 4
switch is nothing actually
it's such as 'if' but it different becus
switch(a){
case 9:
/*statement will work if a is 9*/;break/*to end case*/;
}
if(9 > 8){/*statement will work if it is true*/;}