Skip to main content

FOR

Executes a set of steps for a fixed number of iterations (numeric) or iterates over an array (items).

At a glance

  • Category Control
  • Version: 1.1.0
  • Applications: all
  • Scope: all

Config Options

NameDescriptionDefaultRequiredResolvedConstraintsConditional Rules
varThe name of the variable to set with the current iteration value.NonetruefalsePattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
Length:1-∞
None
startThe starting value of the loop variable (numeric).NonefalsetrueNoneNone
endThe ending value of the loop variable (numeric, inclusive).NonefalsetrueNoneNone
byStep increment for numeric loops (can be negative). If omitted, inferred from start/end (1 or -1).NonefalsetrueNoneNone
itemsAn array to iterate over (e.g., an expression producing an array). If provided, numeric start/end are ignored.NonefalsetrueNoneConflicts: start, end, by
doSteps to execute in each iteration of the loop.NonefalsefalseNoneNone

Step-Level Validation Rules

Require At Least One:

  • At least one of: items, start

Require Together:

  • All or none: start, end

Examples

For numeric loop from 1 to 5

 - step: FOR
var: "i"
start: 1
end: 5
do:
- step: SET
iteration: "{{ flowContext.i }}"

For-each over items

 - step: FOR
var: "item"
items: "{{ flowContext.myList }}"
do:
- step: SET
lastItem: "{{ flowContext.item }}"

See Also

General Resources: