> For the complete documentation index, see [llms.txt](https://appmaster.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://appmaster.gitbook.io/docs/business-logic/block/logic/for-each-loop.md).

# For Each Loop

Iterates over an array. Use the "Loop body" flow output to process each item, and the "Completed" flow output when the iteration has finished.

{% embed url="<https://youtu.be/VD36kwTPssQ>" %}

### Flow Connections

* \[Input] In - starts the block's execution.
* \[Output] Loop body - activates once for each item in the array.
* \[Output] Completed - activates when all the items in the array have been iterated over.

### Data Connections

* \[Input] Array (any) - an array of any data type to be iterated over.
* \[Output] Item (any) - an element in the array, changes with every iteration, automatically adjust its type depending on the input.
* \[Output] Index (integer) - the position of the item in the array (starting at 0), increases by 1 with every iteration.
