Skip to content

Commit 4b0fd45

Browse files
committed
Merge pull request GitbookIO#36 from hasselg/while_loop
While loop grammar and clarity
2 parents e5d8d90 + c199655 commit 4b0fd45

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

loops/while.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# While Loop
22

3-
While Loops can execute a block of code as long as a specified condition is true.
3+
While Loops repetitively execute a block of code as long as a specified condition is true.
44

55
```javascript
66
while(condition){
77
// do it as long as condition is true
88
}
99
```
1010

11-
For example, The loop in this example will continue to run as long as the variable i is less than 5:
11+
For example, the loop in this example will repetitively execute its block of code as long as the variable i is less than 5:
1212

1313
```javascript
1414
var i = 0, x = "";
@@ -18,7 +18,7 @@ while (i < 5) {
1818
}
1919
```
2020

21-
The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true:
21+
The Do/While Loop is a variant of the while loop. This loop will execute the code block once before checking if the condition is true. It then repeats the loop as long as the condition is true:
2222

2323
```javascript
2424
do {
@@ -32,7 +32,7 @@ do {
3232

3333
---
3434

35-
Create using a while-loop a variable named `message` which equals the concatenation of integers (0, 1, 2, ...) as long as its length (`message.length`) is less than 100.
35+
Using a while-loop, create a variable named `message` that equals the concatenation of integers (0, 1, 2, ...) as long as its length (`message.length`) is less than 100.
3636

3737
```js
3838
var message = "";

0 commit comments

Comments
 (0)