> For the complete documentation index, see [llms.txt](https://eleven-fifty-academy.gitbook.io/javascript-101-fundamentals/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eleven-fifty-academy.gitbook.io/javascript-101-fundamentals/1-javascript-fundamentals/1-js-fundamentals/3-loops/do-while.md).

# Do While

## Do...While Statement Loops

The `do...while` statement loop repeats until a specified condition comes back as FALSE.\
&#x20;The statement (i.e. `i+= 1;`) executes **once before the condition is checked**; to execute multiple statements, use a block statement (i.e. `{...}`) to group the statements together.\
&#x20;If the condition (i.e. `i < 5`) is TRUE, the statement will loop again.\
&#x20;At the end of every execution, the condition is checked. When the condition is FALSE, the loop stops and control passes.

```javascript
//do while loops

var i = 0; 
do /* do */ {
  i += 1; /* statement */
  console.log(i);
} while (i < 5); /* while (condition) */

// Practice

var text = "";
var i = 0;

do { 
  text += "The number is: " + i;
  i++;
} while (i < 10); // "The number is: 0", "The number is: 1", ... "The number is: 10"
```
