# `do`

_Evaluate expressions a set number of times_
```syntax
do[count;e1;e2;e3;…;en]
```

Control construct. Where

- `count` is an integer atom
- `e1`, `e2`, … `en` are expressions

q evaluates the expressions `e1` to `en` in order, `count` times.
If `count` is zero, negative, or null, q doesn't evaluate the expressions.

The result of `do` is always the [generic null](identity.md#null).

Continued fraction for $\pi$, for 7 steps:
```q
q)r:()
q)t:2*asin 1
q)do[7;r,:q:floor t;t:reciprocal t-q]
q)r
3 7 15 1 292 1 1
```

> **Warning — `do` is a control construct, not a function**
>
>
> You cannot iterate or project it.
>
## Name scope

The brackets of the expression list do not create lexical scope.
Name scope within the brackets is the same as outside them.

----

[Accumulators – Do](accumulators.md#do),
[`if`](if.md),
[`while`](while.md)


[Controlling evaluation](control.md)


_Q for Mortals_
[§10.1.6 `do`](../learn/q4m/10_Execution_Control.md#1016-do)
