Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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