# Loop

Repeat a processing sequence until its continuation condition becomes false.

Use it when results from one iteration determine whether another is needed.

## Configure the loop

| Part | Purpose |
| --- | --- |
| Initialization | Optional; runs once before entering the loop |
| Condition node | Required; produces the data used to decide whether to continue |
| Continuation condition | Required; runs the body when true |
| Loop body | Required nodes or chain for each iteration |
| Exit processing | Optional; prepares results after exiting |
| Following chain | Optional; continues after the loop finishes |

## Make sure the loop can end

The body must update state used by the next condition, such as a counter, remaining work, or completion flag. A condition that stays true with unchanged state cannot end normally.

Define an exit condition and prepare downstream results during exit processing. Save each iteration's results inside the body if you need to retain them.

## Example: a fixed number of iterations

Flow: Initialize counter and limit → Check counter below limit → Process and increment → Check again → Exit.

With a counter of 0 and a limit of 3, increment after each iteration and ensure the next condition reads the updated value. Match the actual expression to the body's output structure.

## Related pages

- [Variables and data flow](../../variables-and-data.md)
- [Run and debug](../../run-debug.md)
