Skip to content

While

Type: while  ·  Package: Core Activities v1.0.0

Repeats a block of activities as long as a condition is true. The condition is evaluated before each turn: if it is false from the beginning, the block is not executed even once. Use it when you don’t know in advance how many turns it will take — it depends on something that changes: “as long as there are more pages”, “as long as the queue has elements”, “until the balance reaches zero”.

  1. Evaluate the condition.
  2. If true, execute activities and return to step 1.
  3. If false, terminate and continue the flow.

Supports Break (exit immediately) and Continue (jump to the next evaluation).

ParameterEditorDescription
conditionexpressionBoolean condition that is evaluated before each turn. Ex: = quedanPaginas.

Ninguno.

Activities that are executed in each round while the condition is true.

Process a queue until empty:

Set Variable name = hayItem value = true
While condition = = hayItem
└─ activities:
Queue Get Item queue = "facturas" output = item
If condition = = isNull(item)
├─ then:
│ Set Variable name = hayItem value = false // ya no quedan: corta el bucle
└─ else:
Invoke Playbook path = "procesar.json" input = = { factura: item }
SymptomCausaSolution
The loop never runsThe condition was already false upon entryCheck the initial value of the condition variables
Execution hangsInfinite loop: condition never changesIt ensures that the body modifies the condition; adds a safety stop
  • For Each — loop through the elements of a collection.
  • For Loop — repeat a counted number of times.
  • Break / Continue — control the loop from within.