0
Is it necessary to put default statement always?
4 Answers
+ 2
yes to avoid errors and make the code clean and understandable and if u dont wanna include default statement write ur code which doesnt need a default statement
+ 2
No it's not compulsory but keeping in with the programming norms, one should have the default statement
0
nope!
0
its neccessary to use a default statement to avoid errors at runtime. using defaults is just like the try & catch.
its neccessary that every user can input anything they like. if their input doesnt match the cases in the switch statement, thats when the default statement comes in handy.