Created
October 4, 2018 21:08
-
-
Save bseib/f5ee5c5baa31fa116feb715bd4037cb5 to your computer and use it in GitHub Desktop.
using break in nested loops
This file contains 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
// 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