Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 278ee28

Browse files
authored
Finish updating while-for
1 parent e1739fc commit 278ee28

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎1-js/02-first-steps/12-while-for/article.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ while (i < 3) { // shows 0, then 1, then 2
3131

3232
A single execution of the loop body is called *an iteration*. The loop in the example above makes three iterations.
3333

34-
If there were no `i++` in the example above, the loop would repeat (in theory) forever. In practice, the browser provides ways to stop such loops and in server-side JavaScript, we can kill the process.
34+
If `i++` was missing from the example above, the loop would repeat (in theory) forever. In practice, the browser provides ways to stop such loops, and in server-side JavaScript, we can kill the process.
3535

3636
Any expression or variable can be a loop condition, not just comparisons: the condition is evaluated and converted to a boolean by `while`.
3737

@@ -166,7 +166,7 @@ alert(i); // 3, visible, because declared outside of the loop
166166

167167
### Skipping parts
168168

169-
Any part of the `for` syntax can be skipped.
169+
Any part of `for` can be skipped.
170170

171171
For example, we can omit `begin` if we don't need to do anything at the loop start.
172172

@@ -190,9 +190,9 @@ for (; i < 3;) {
190190
}
191191
```
192192

193-
The loop became identical to `while (i < 3)`.
193+
This makes the loop identical to `while (i < 3)`.
194194

195-
We can actually remove everything, thus creating an infinite loop:
195+
We can actually remove everything, creating an infinite loop:
196196

197197
```js
198198
for (;;) {
@@ -229,7 +229,7 @@ alert( 'Sum: ' + sum );
229229

230230
The `break` directive is activated at the line `(*)` if the user enters an empty line or cancels the input. It stops the loop immediately, passing control to the first line after the loop. Namely, `alert`.
231231

232-
The combination "infinite loop + `break` as needed" is great for situations when a loop's condition must be checked not in the beginning or end of the loop, but in the middle or even in several places of the body.
232+
The combination "infinite loop + `break` as needed" is great for situations when a loop's condition must be checked not in the beginning or end of the loop, but in the middle or even in several places of its body.
233233

234234
## Continue to the next iteration [#continue]
235235

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /