For each
Description
Iterates over each element in an array, firing the loop-body pin with element and index outputs, then the completed pin when the array is exhausted. Element type resolves on connection. A null or empty array iterates zero times and goes straight to completed.
When to use
Use For each to process every element of an array one at a time. Wire the nodes
you want to run per element off the loop-body execution pin — they can read element
and index as argument inputs. Once all elements are processed, the completed pin
fires once so you can add a final step such as a summary log or an HTTP call — it fires
even when there was nothing to iterate, so an optional array that arrived empty or null
needs no guard. For a simple numeric range without an existing array, use For loop
instead.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| Array | generic[] | — | The array to iterate over. The element type resolves to the connected array's element type at design-time. An empty array iterates zero times, and so does a null array — for example an optional array field that arrived as JSON null. |
Output pins
| Pin | Type | Notes |
|---|---|---|
| Element | generic | The current element on each loop-body iteration. Type matches the array's element type. |
| Index | integer | The zero-based position of the current element. |
Execution pins
| Pin | Direction |
|---|---|
| In | Input |
| Loop body | Output |
| Completed | Output |
Example
Log each item in a string array returned by Split. Wire the Result output of Split into the Array input of For each. On the Loop body execution output, connect a Log message and wire the Element output into its Message input. After all iterations the Completed execution output fires a final Log message confirming all items were logged.