If we dont use break, why would it compile the cases that dont match

16th Jun 2016, 8:08 AM
Nisarg Uchiha
Nisarg Uchiha - avatar
2 Answers
+ 2
if we don't use break then when we run program the switch search the match and after that the case complete he took other case defined after him as a nested case and does not break switch statement so it is necessary to define break after case complete
16th Jun 2016, 10:36 AM
DJ Shiva & DJ Baba Shiv-Shekhar
DJ Shiva & DJ Baba Shiv-Shekhar - avatar
thats why we use it. to get out Switch.
16th Jun 2016, 7:28 PM
Klodian Lula
Klodian Lula - avatar