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?

12th Jul 2016, 7:21 PM
Vrushabh
4 Answers
+ 2
Switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via a multiway branch.
13th Jul 2016, 3:55 AM
Manu
+ 1
What ?Manessa said. But it's like a if statement except you can't use mathrmatical operators ex: +×<>=
13th Jul 2016, 5:14 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
+ 1
switch is a control statement to switching to different cases as per passed value if no case is matched the default case is executed.
31st Jul 2016, 4:58 AM
Anand Kumar
Anand Kumar - avatar
+ 1
It's like a if else statement, but you can't use operators or bools. Another difference is that the values are alwaysfixed,it cant be skmething like less than 10 etc. Hope this helps!
16th Aug 2016, 3:27 PM
Taj K.