Skip to content

For Loop

Type: for-loop  ·  Package: Core Activities v1.0.0

Repeats a block of activities a counted number of times, keeping a numerical rate that increases with each round. Use it when you know how many times to loop (scroll 10 pages, generate 5 reports) and you’re not looping through the elements of a collection.

Count from from (included) to to (excluded), adding step on each lap. In each iteration it saves the current value in the variable indexVariable and executes activities.

from = 0, to = 3, step = 1 → índice toma 0, 1, 2 (3 vueltas; el 3 NO se ejecuta)
from = 1, to = 11, step = 1 → índice toma 1, 2, …, 10 (10 vueltas)
from = 0, to = 10, step = 2 → índice toma 0, 2, 4, 6, 8

Supports Break and Continue inside the body.

ParameterEditorDescription
fromnumberInitial index (included).
tonumberEnd Index (excluded): The loop runs as long as index < to.
ParameterEditorDescription
stepnumberHow much the index increases per lap. By default 1.
indexVariablenombre de variableVariable with the current index. By default i.

Activities that are executed in each lap.

Go through the first 5 pages of a web listing:

For Loop from = 1 to = 6 indexVariable = pagina
└─ activities:
Page Navigate url = = "https://erp.cliente.com/listdo?page=" + pagina
Log level = info message = = "Procesando página " + pagina
  • For Each — when you loop through the items of a list or table, not a count.
  • While — when you don’t know how many turns, but depend on a condition.
  • Break / Continue — break out of the loop or jump to the next lap.