0
Which is better: switch statement or if else statement
2 Antworten
+ 4
if() and else{} can use && and ! easily....
While switch not but shorten....
+ 2
Switch statements are used for aesthetics & code readability. Instead of using 10 or more "else if"s, if you use a switch statement , you need fewer keystrokes as well. There is no performance advantage of using one over the other. I use JavaScript.