Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   Java (http://siteownersforums.com/forumdisplay.php?f=12)
-   -   What’s the purpose of using Break in each case of Switch Statement? (http://siteownersforums.com/showthread.php?t=166751)

Shivangi Panwar 03-21-2016 01:54 AM

What’s the purpose of using Break in each case of Switch Statement?
 
What’s the purpose of using Break in each case of Switch Statement?

Kunal 03-21-2016 01:56 AM

Break is used after each case (except the last one) in a switch so that code breaks after the valid case and doesn’t flow in the proceeding cases too.

If break isn’t used after each case, all cases after the valid case also get executed resulting in wrong results.

aajokhio 03-23-2016 06:01 AM

Basically, Break statement stop a program, and after break statement, any program does not display.

SaraSanjay 06-06-2016 10:40 PM

The break statement to end processing of a particular case


All times are GMT -7. The time now is 09:46 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.