---
title: "for"

doc_type: static
doc_category: static
doc_version: v20260901
source_url:
  html: 'https://developer.shopline.com/docs/handlebars/helpers/iteration/for'
  md: 'https://developer.shopline.com/docs/handlebars/helpers/iteration/for.md'
---
# for

Renders an expression for each item in an array.

You can use a for loop for up to 50 iterations. If you need to iterate over more than 50 items, use the `paginate` helper to split the items into multiple pages.

> **Tip**
>
> Each `for` loop has an associated [forloop object](https://developer.shopline.com/docs/handlebars/objects/forloop.md) that contains information about the loop.

## Parameters

- `list` {Array} - The list to iterate over.
- `hash.limit` {Number} - Limits the number of iterations.
- `hash.offset` {Number} - Specifies the starting element for iteration (1-based index).
- `hash.reversed` {Boolean} - Use the reversed parameter to iterate in reverse order.

## Usage

```handlebars
{{#for array as |item|}}
  expression
{{else}}
  empty
{{/for}}
```

## Examples

<Example data={'collection.products'}>
```handlebars
{{#for collection.products as |product|}}
  {{product.title}}
{{else}}
  There are no products in this collection.
{{/for}}
```
</Example>

### limit

<Example data={'collection.products'}>
```handlebars
{{#for collection.products limit=2 as |product|}}
  {{product.title}}
{{/for}}
```
</Example>

### offset

<Example data={'collection.products'}>
```handlebars
{{#for collection.products offset=2 as |product|}}
  {{product.title}}
{{/for}}
```
</Example>

### reversed

<Example data={'collection.products'}>
```handlebars
{{#for collection.products reversed=true as |product|}}
  {{product.title}}
{{/for}}
```
</Example>