Created
October 4, 2013 02:47
-
-
Save liuyix/6820243 to your computer and use it in GitHub Desktop.
Breaking out of nested loops in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //credit:http://stackoverflow.com/a/886979 | |
| outerloop: | |
| for (int i=0; i < 5; i++) { | |
| for (int j=0; j < 5; j++) { | |
| if (i * j > 6) { | |
| System.out.println("Breaking"); | |
| break outerloop; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment