# doWhile {#dowhile}

**Parent topic:**[Programming Statements](../../Programming/ProgrammingStatements/programming_statements.md)

## Syntax {#syntax}

```
do{ 
   statements 
} 
while (conditions);
```

## Details {#details}

The do-while loop first executes the do statement, then checks the condition at the bottom of the loop. This guarantees the loop is executed at least once. "while" cannot be used in the beginning of a statement. Both parentheses \(\) after while and braces \{ \} after do are mandatory for do-while statements.

## Examples {#examples}

```
x=1
do {x+=2} while(x<100)
x;
// output: 101

x=1
y=0
do {x+=y; y+=1} while(x<100 and y<10);
x;
// output: 46
y;
// output: 10
```

