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
{{ message }}
Repository navigation
Commit cf6d822
Browse filesBrowse the repository at this point in the historyBrowse files
The do...while statement creates a loop that executes a specified statement until the test condition evaluates to be false. The condition is evaluated after executing the statement.
4
+
Syntax for do... while is
5
+
6
+
```javascript
7
+
do{
8
+
// statement
9
+
}
10
+
while(expression) ;
11
+
```
12
+
13
+
Lets for example see how to print numbers less than 10 using `do...while` loop:
14
+
15
+
```
16
+
var i = 0;
17
+
do {
18
+
document.write(i + " ");
19
+
i++; // incrementing i by 1
20
+
} while (i < 10);
21
+
```
22
+
23
+
>***Note***: `i = i + 1` can be written `i++`.
24
+
25
+
26
+
{% exercise %}
27
+
Using a do...while-loop, print numbers between less than 5.
0 commit comments