GeezerVison is showing github.com — Merge pull request #36 from hasselg/while_loop · RedHandedBandit/javascript@4b0fd45
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: loops/while.md +4-4Lines changed: 4 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | # While Loop |
2 | 2 |
|
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. |
4 | 4 |
|
5 | 5 | ```javascript |
6 | 6 | while(condition){ |
7 | 7 | // do it as long as condition is true |
8 | 8 | } |
9 | 9 | ``` |
10 | 10 |
|
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: |
12 | 12 |
|
13 | 13 | ```javascript |
14 | 14 | var i = 0, x = ""; |
@@ -18,7 +18,7 @@ while (i < 5) { |
18 | 18 | } |
19 | 19 | ``` |
20 | 20 |
|
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: |
22 | 22 |
|
23 | 23 | ```javascript |
24 | 24 | do { |
|
32 | 32 |
|
33 | 33 | --- |
34 | 34 |
|
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. |
36 | 36 |
|
37 | 37 | ```js |
38 | 38 | var message = ""; |
|