- 1

i m not understanding how to use break

12th May 2017, 5:50 AM
Akshat Bhatt
Akshat Bhatt - avatar
2 odpowiedzi
+ 4
you use a break in a switch after each case because else if the case is true and you didn't use a break it wil run all the cases after the case that was true.
12th May 2017, 9:56 AM
johan beimers
johan beimers - avatar
+ 2
First of all break are not meant for switch case only. Basically whenever you want to exit from loop (i.e for, foreach etc) put 'break' there. In case of switch case we use break after each case so that if any case satisfy the condition we do not need to look at other cases.
13th May 2017, 5:43 PM
Munish
Munish - avatar