Docs / Transformers / While

# While

Repeat loop body until a condition is met.

## Ports

Inlet
Input (any)
Outlets
Loop (any) — fires each iteration
Done (any) — fires when condition is met or max iterations reached

## Configuration

Parameter | Type | Default | Description
--- | --- | --- | ---
`conditionField` | text | `"done"` | The payload key to check each iteration. This is a raw key name (not a template) — it references loop-body state directly. Supports dot notation for nested fields (e.g. `data.done`), same as the Condition node.
`conditionValue` | text | `"true"` | The value to compare against. Supports `{{variable}}` templates, re-evaluated against the current payload on each iteration — e.g. `{{target}}` compares the condition field to another payload value that can change inside the loop.
`conditionMode` | dropdown | `until` | `until` stops when condition matches; `while` continues as long as it matches.
`maxIterations` | number | `20` | Safety limit to prevent infinite loops. The loop exits via Done when this limit is reached.

## Output Payload

When the loop exits via the Done outlet, the payload includes:

`_while_exceeded` Boolean. `true` if the loop stopped because `maxIterations` was reached rather than the condition being satisfied.

## Example

← For Each Template →