What happens default statement omitted......?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What happens default statement omitted......??

there is no value asigned so default statement printed but if we omitted...??

4th Mar 2018, 2:37 PM
Saravanan
Saravanan - avatar
1 Answer
+ 2
Well...nothing. If there is no default and the case statement has no matches...it’s just done. Try it in code and see. Default is not required and in absence of a match it’s as though you never entered the conditional.
5th Mar 2018, 12:03 AM
Gary Kovar
Gary Kovar - avatar