what is switch | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is switch

switch and break

11th Sep 2016, 4:30 AM
Prakash Chandra Joshi
Prakash Chandra Joshi - avatar
4 Answers
+ 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....
11th Sep 2016, 1:46 PM
Balaji Rs
Balaji Rs - avatar
+ 1
switch is a decision making choice based statement.
13th Sep 2016, 1:39 PM
Twinkle Baisane
Twinkle Baisane - avatar
0
Um ok I cant write a good advice :P
12th Sep 2016, 3:15 AM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar
- 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*/;}
11th Sep 2016, 9:53 AM
JS of MC(not C++ || java)
JS of MC(not C++ || java) - avatar