Do...While

Execute connected nodes repeatedly until a condition is met — the n8n do...while loop

Do...While

AI-generated

Summary

Executes connected nodes repeatedly until a condition expression evaluates to true, with optional wait between iterations and a safety max‑iterations cap.

Inputs

  • main (required) — Data items to evaluate. Each item is enriched with a _loop object containing iteration metadata before condition checking.

Output shape

fixed

Two outputs are always produced, in order: Condition Met (index 0) and Loop (index 1). Items appear in exactly one of the two branches per execution.

Examples

Example 1: Simple polling loop

Condition: {{$json.status === 'done'}}, Max Iterations: 30, Wait Between Iterations: 5, On Max Iterations Reached: Exit via Condition Met pin (with timeout flag). Connect the Loop output to an HTTP Request node that fetches a resource, then route the request's output back into the Do...While node's input. Connect the Condition Met output to a Set node that finalizes the result.

Links

Discussion