While loop

Flow control
While loop
Loop
Condition false
Completed

Description

Repeats the loop pin while the boolean condition is true, re-evaluating the condition before each iteration, then fires completed once it becomes false. Wire a node that the loop body changes (e.g. a local variable) into the condition so the loop can end.

When to use

Use While loop when you need to repeat a block of nodes an unknown number of times — for as long as a condition holds — rather than a fixed count. Drive the condition from state the body mutates, such as a local variable you increment or a flag you flip, so the loop eventually exits. For a known number of iterations use For loop, and to walk an existing array use For each. The completed pin fires once after the condition becomes false. As a safety net the loop stops after 100,000 iterations and fails the pipeline, so a condition that never becomes false surfaces as an error rather than hanging.

Pins

Input pins

Pin Type Default Notes
Condition boolean false Re-evaluated before every iteration. Wire a comparison or boolean-logic node here that depends on state the loop body changes — otherwise the loop never ends.

Execution pins

Pin Direction
In Input
Loop Output
Completed Output

Example

Retry a flaky HTTP call until it succeeds or an attempt budget runs out. Keep an attempts local variable starting at 0 and a succeeded boolean starting at false. Wire a condition of “not succeeded AND attempts less than 5” into the While loop. On the Loop pin, make the HTTP request, set succeeded on its success branch, and increment attempts. When the condition becomes false the Completed pin fires and a final Log message reports the outcome.

See also