You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/13-while-for/article.md
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -368,9 +368,18 @@ break label; // jump to the label below (doesn't work)
368
368
label: for (...)
369
369
```
370
370
371
-
A call to `continue` is only possible from inside the loop.
371
+
A `break` directive must be inside a code block. Technically, any labelled code block will do, e.g.:
372
+
```js
373
+
label: {
374
+
// ...
375
+
break label; // works
376
+
// ...
377
+
}
378
+
```
379
+
380
+
...Although, 99.9% of the time `break` used is inside loops, as we've seen in the examples above.
372
381
373
-
The `break` directive may be placed before code blocks too, as `label: { ... }`, but it's almost never used like that. And it also works only inside-out.
0 commit comments