0

Is it necessary to put default statement always?

31st Jul 2016, 4:54 AM
Anand Kumar
Anand Kumar - avatar
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
31st Jul 2016, 5:29 AM
Suhail Pappu
Suhail Pappu - avatar
+ 2
No it's not compulsory but keeping in with the programming norms, one should have the default statement
31st Jul 2016, 5:29 AM
Vamsi Manepalli
Vamsi Manepalli - avatar
0
nope!
31st Jul 2016, 8:49 PM
ahref
ahref - avatar
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.
20th Oct 2016, 11:02 PM
Franky BrainBox
Franky BrainBox - avatar