+ 3

if we don't use default case then is there will be any problem??

20th Jan 2017, 4:51 PM
jigs chauhan
9 Respuestas
+ 5
No
20th Jan 2017, 5:02 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 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.
20th Jan 2017, 5:20 PM
Govind Choudhary
Govind Choudhary - avatar
0
plzz answer me if anyone knows its so confusing 😕
20th Jan 2017, 4:53 PM
jigs chauhan
0
thanks a lot
20th Jan 2017, 5:02 PM
jigs chauhan
0
there will be no problem, the reason why we use default is to cater for anything outside the options we have.
5th Feb 2017, 8:16 PM
Elijah
Elijah - avatar
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.
1st Mar 2017, 11:01 AM
Neha
Neha - avatar
0
no there won't be any problem
23rd Mar 2017, 10:20 AM
edwin
edwin - avatar
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
23rd Mar 2017, 12:37 PM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar