Skip to content

For Each Loop

Iterates over an array or map, executing a sub-graph for each item.

This node iterates over each item in an Iterable (such as an array or a map).

Execution Flow#

  1. The loop starts when the Execute input is triggered.
  2. For each item in the input array/map, the node: - Sets the Key and Value output ports. - Triggers the Body execution output.
  3. The Break input can be triggered at any time (e.g., from within the Body execution path) to stop the loop.
  4. After all items have been processed, or if the loop was stopped by the Break input, the Completed execution output is triggered.

Ports#

  • Key: For an array, this is the numeric index. For a map, this is the key.
  • Value: The value of the element at the current key/index.

Inputs#

Port Description
Execute
Starts the loop.
Break
Stops the loop. The Completed path is executed afterwards.
invalid port type: iterable Input
The array or map to iterate over.

Outputs#

Port Description
Body
Executed for each item in the loop.
Key
The index (for an array) or key (for a map) of the current item.
Value
The value of the current item.
Completed
Executed after the loop finishes or is broken.

ID: core/for-each-loop@v1