# Iterative Statements

Iterative statements let you repeat a statement until a specified expression becomes false, or a **`return`** within the statement body is executed.

## While Statement

### Syntax <a href="#syntax" id="syntax"></a>

*`iteration-statement`*:\
 **`while (`***`expression`***`)`** [*`statement`*](https://glados-2.gitbook.io/clight/reference/statements)

### Example

<pre class="language-c"><code class="lang-c"><strong>int a = 0;
</strong>while (a != 2) {
    a++;
}
</code></pre>

&#x20;In this example, `a` is increased by 1 until it is equal to 2.

## For Statement

The body of a **`for`** statement is executed zero or more times until an optional condition becomes false. You can use optional expressions within the **`for`** statement to initialize and change values during the **`for`** statement's execution.

### Syntax

*`iteration-statement`*:\
 **`for`** **`(`** *`init-expression`*&#x6F;pt **`;`** *`cond-expression`*&#x6F;pt **`;`** *`loop-expression`*&#x6F;pt **`)`** [*`statement`*](https://glados-2.gitbook.io/clight/reference/statements)

### Example

```c
for (int i = 4; i > 0; i--) {
}
```

&#x20;In this example, i is decreased by 1 until it is equal to zero.
