why can i make a decision with switch statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why can i make a decision with switch statement

11th Nov 2016, 12:22 PM
solomon tudu
solomon tudu - avatar
2 Answers
0
yes u can switch(condition){ case 'a' : desicion1; break; case 'b' : desicion2; break; }
11th Nov 2016, 12:30 PM
Dhruv Saxena
Dhruv Saxena - avatar
0
when we have one condition with more than two cases let say we have var X switch is easy to implemented it's say in case x= something do that. simply switch can make more one compare unlike if statement and it's fast in compiling unlike if too. hope that's help.
4th Dec 2016, 5:12 AM
Mohammed Shalan
Mohammed Shalan - avatar