+ 3
if we don't use default case then is there will be any problem??
9 Answers
+ 5
No
+ 2
see
default is used when all other cases fail to satisfy the condition
and if you want to do something in all such cases use default
otherwise don't use it
I have posted a program around 50mins ago
"Integer to Roman Converter"
see this,
it will be more clear.
0
plzz answer me if anyone knows its so confusing đ
0
thanks a lot
0
there will be no problem, the reason why we use default is to cater for anything outside the options we have.
0
Default is used when no option is correct. So, if one or more than one option is correct then there is no need to use it.
0
no there won't be any problem
0
No it won't be a problem I think! It is just like having an else statement in the if else condition where else is not mandatory..
if we put default statement it would be of situation if all the cases are not specified then that default part will get executed otherwise if it is not there then control will just come out from switch.
hope u understood