Last active
November 25, 2020 11:04
-
-
Save salomvary/d268e340bf787689d6b79ce7d8930bd0 to your computer and use it in GitHub Desktop.
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
// Works fine but what does `break` break and `continue` continue? | |
for (x of y) { | |
switch (x) { | |
case '': | |
if (condition) | |
continue | |
else | |
break | |
} | |
// Do more stuff | |
} | |
// Labels make it more explicit what break | |
// and continue apply to (`for` vs `switch`) | |
loop: for (x of y) { | |
conditions: switch (x) { | |
case '': | |
if (condition) | |
continue loop; | |
else | |
break conditions; | |
} | |
// Do more stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment