Skip to content

Instantly share code, notes, and snippets.

@liuyix
Created October 4, 2013 02:47
Show Gist options
  • Select an option

  • Save liuyix/6820243 to your computer and use it in GitHub Desktop.

Select an option

Save liuyix/6820243 to your computer and use it in GitHub Desktop.
Breaking out of nested loops in Java
//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