# while proc

Source: https://ref.dm-lang.org/proc/while

### Format
> `while(E) Statement`

If E is true (non-zero) execute Statement. Continue testing E and doing the while block until E becomes false (zero).

Statement may be a block of code or a single statement.

```dm /while/
var/i = 3
while(i)
  world << i--
```

This outputs:

```dm /while/
3
2
1
```

### See also
- [break statement](https://ref.dm-lang.org/proc/break.md)
- [continue statement](https://ref.dm-lang.org/proc/continue.md)
- [do proc](https://ref.dm-lang.org/proc/do.md)
- [for loop proc](https://ref.dm-lang.org/proc/for/loop.md)
