0
when is it necessary to use the switch command and the default command
2 Antworten
+ 5
The switch statement is generally used for a variable with discrete values. The default block runs if there is no case which matches.
- 1
It's handy if you want to check a variable to be many different values. In that case it's shorter than an if-if else-else thing.