From 293c9b7f4759fc5f9065419d61c58a4e822421ef Mon Sep 17 00:00:00 2001 From: Lavrentiy Rubtsov Date: Fri, 27 May 2022 20:07:25 +0600 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=91=BE=20smth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-js/02-first-steps/13-while-for/article.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index eadbf532..c4468996 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -162,10 +162,8 @@ for (i = 0; i < 3; i++) { // use an existing variable alert(i); // 3, visible, because declared outside of the loop ``` - ```` - ### Skipping parts Any part of `for` can be skipped. @@ -286,7 +284,6 @@ if (i > 5) { ...and rewrite it using a question mark: - ```js no-beautify (i > 5) ? alert(i) : *!*continue*/!*; // continue isn't allowed here ``` @@ -321,6 +318,7 @@ We need a way to stop the process if the user cancels the input. The ordinary `break` after `input` would only break the inner loop. That's not sufficient -- labels, come to the rescue! A *label* is an identifier with a colon before a loop: + ```js labelName: for (...) { ... @@ -362,6 +360,7 @@ The `continue` directive can also be used with a label. In this case, code execu Labels do not allow us to jump into an arbitrary place in the code. For example, it is impossible to do this: + ```js break label; // jump to the label below (doesn't work) From 15ed0d09533145b5fda50115497b14c224530146 Mon Sep 17 00:00:00 2001 From: Lavrentiy Rubtsov Date: Fri, 27 May 2022 20:19:36 +0600 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=91=BE=20add=20missed=20break=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-js/02-first-steps/13-while-for/article.md | 1 + 1 file changed, 1 insertion(+) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index c4468996..dcc3b692 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -340,6 +340,7 @@ The `break ` statement in the loop below breaks out to the label: // do something with the value... } } + alert('Done!'); ``` From 070b77790548934e274070423ba94f7ad0703aa8 Mon Sep 17 00:00:00 2001 From: Lavrentiy Rubtsov Date: Fri, 27 May 2022 20:25:06 +0600 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=91=BE=20smth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1-js/02-first-steps/13-while-for/article.md | 1 + 1 file changed, 1 insertion(+) diff --git a/1-js/02-first-steps/13-while-for/article.md b/1-js/02-first-steps/13-while-for/article.md index dcc3b692..e1c5ad38 100644 --- a/1-js/02-first-steps/13-while-for/article.md +++ b/1-js/02-first-steps/13-while-for/article.md @@ -369,6 +369,7 @@ label: for (...) ``` A `break` directive must be inside a code block. Technically, any labelled code block will do, e.g.: + ```js label: { // ...