+ 2

Is there a difference in using a switch statement with cases and using an else statement with else ifs ? - seems like not.

the difference is that switch is faster.

16th Jun 2016, 8:14 PM
2 Answers
+ 6
Switch allows only to branch on specific values. if else if allowed to branch on much more complex conditions
24th Jun 2016, 3:48 PM
J Arrow
if you compare one or two statement use if else. but if you got more complex scenarios, switch case structure is wiser and tidy.
12th Jan 2017, 7:17 PM
Hakkı Karahan
Hakkı Karahan - avatar