# Foreach

Foreach action is just a more readable way of handling iteration over an array. Only thing to keep in mind is that **Iterate over** is JavaScript expression, if you want to reference data from other actions you need to use **ctx** object. **Iterator variable** on the other hand is not an expression but is just a name for output value that will be stored in **ctx** object.

<figure><img src="https://296734879-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQlDOQVFjSsWJSm47zpFE%2Fuploads%2FoqoxKytEY64Leh4uKuDt%2FForeach%20section.png?alt=media&#x26;token=7210051d-7034-4eb1-89c8-17220f0f9b93" alt=""><figcaption></figcaption></figure>

### Iterator variable

Iterator variable is not an expression but a name for where to store the currently iterating item. With above example first item will be `ctx.product = ctx.products[0]` and so on for each iteration.
