+ 2
Isn't it necessary for a switch statement to have a default case?
6 ответов
+ 19
No, it's not.
In all languages the default case can be omitted. For example, you can find it in a Javascript lesson:
https://www.sololearn.com/learn/JavaScript/1139/
+ 1
its more about discipline and forward thinking.. when u write a program for switch case, if you can anticipate every possible case then you probably can skip default, else it will always give you insight if things go wrong by placing a default handle
0
no...no itsnt neccessary...
nothing is neccessary in a switch...
not even break;
0
No, It is not.
0
nope