Skip to content

Instantly share code, notes, and snippets.

@bseib
Created October 4, 2018 21:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bseib/f5ee5c5baa31fa116feb715bd4037cb5 to your computer and use it in GitHub Desktop.
Save bseib/f5ee5c5baa31fa116feb715bd4037cb5 to your computer and use it in GitHub Desktop.
using break in nested loops
// from https://stackoverflow.com/questions/12393231/break-statement-inside-two-while-loops/12393289#12393289
void example1() {
outer: while(a) {
while(b) {
if(b == 10) {
break outer;
}
}
}
// break will take you here.
}
void example2() {
while(a) {
while(b) {
if(b == 10) {
break;
}
}
// break will take you here.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment