Loops
Theloop step iterates over an array from the state bag and runs nested steps for each element. It is useful for processing lists, validating each item in a collection, or generating dynamic reports.
Basic Loop
foreach format is list_variable, item_variable. The first part references an array in the state bag, the second part is the name each element gets during iteration.
Loop Variables
During each iteration, these variables are available inside the loop body:Nested Steps
A loop body can contain multiple steps of any type:Extracting an Array for Looping
You will typically extract an array from a previous step:From Shell
From Database
Auto-Cleanup
When the loop finishes, the item variable andindex are automatically deleted from the state bag. This prevents them from leaking into steps after the loop:
What’s Next?
- Compose workflows across files with workflow chaining
- Run workflows in parallel with parallel execution