+ 3

What if we put default case first while testing conditions in switch case,without having break in any of the consecutive cases?

How the compiler checks the conditions in switch case...how does the flow of compiler affects the output..??

4th Jul 2019, 3:24 PM
Shivam Singh
Shivam Singh - avatar
2 odpowiedzi
+ 1
it will flow to default if doesnt have break ,u can check out this code https://code.sololearn.com/cqF5Hl1HlEJ2/?ref=app
10th Jul 2019, 3:26 PM
Tzion
Tzion - avatar
0
It will take time to compile untill that last line reaches and shows output as per matched condn but not preferred bcz of time wastage
11th Jul 2019, 9:50 AM
Nishant Singh
Nishant Singh - avatar