Skip to main content

While

Controlled node

Overview​

Repeat a branch while a variable meets a condition.

While repeats a branch while a comparison is true. It reads a named variable before each iteration and stops when the comparison becomes false.

Use it when the number of repetitions depends on a value updated by the loop. For a known repeat count, Loop is simpler.

Inputs​

InputTypeDescription
runEventStarts checking the condition.
variableNameTextThe variable name or path to read, such as counter or response.status.
DynamicDataAdditional sockets created when the variable name includes placeholders such as item_{{id}}.

Use a plain path like response.status to read that variable. Placeholders are for constructing the name, not for entering the condition itself.

Properties​

PropertyTypeDescriptionDefault
operationChoiceContinue-condition comparison: <, <=, ==, !=, >= or >. Choose explicitly.-
breakValueDataTarget value to compare the named variable against.-

Set Variable Name and Condition in the properties panel. The available comparisons are <, <=, ==, !=, >= and >. Choose the operator and target explicitly.

Equality and inequality can match text values. Ordering comparisons are numeric; use numbers or numeric text for them.

The condition is a continue condition, not a stop condition: counter < 5 means “keep going while counter is below five.”

Outputs​

OutputTypeDescription
loopEventRuns the branch when the condition is true.
indexNumberThe current iteration, starting at 0.
finishedEventFires when the condition is false, including at the first check.

Example: repeat until a counter reaches five​

  1. Use Set Variable to store the numeric value 0 under counter.
  2. Connect its done event to While's run.
  3. Set Variable Name to counter and Condition to value < 5.
  4. Connect loop to your processing branch.
  5. At the end of that branch, use Variable and Formula to calculate counter + 1, then Set Variable to save the new value.
  6. Connect finished to the action that follows the loop.

Repetition is automatic. Do not connect the counter update back to While's run input.

Avoid endless loops​

Initialise the variable before starting and ensure the repeated branch changes it so the condition can eventually become false. An execution limit can stop an endless loop, but it is not a substitute for a termination condition.

The node reads a local variable first, then falls back to a top-level variable. Update the same scope that the condition is reading. It does not insert a pause between iterations, so consider the impact of repeated API requests or other external actions.