# Loop

Run steps once for each item in a list.

## Do things in Loop

Add a **Loop** step. Choose the row to see all its fields.

- [Loop on Items](https://docs.gorunner.io/apps/loop#fields-f-loop-on-items): Iterate over each item in a list.

Later steps read a step’s output by its name: see [Use data from earlier steps](https://docs.gorunner.io/build/use-data-from-earlier-steps).

For a step-by-step guide, see [Branch and loop](https://docs.gorunner.io/build/branch-and-loop).

Not in your list? See [When an app isn’t here](https://docs.gorunner.io/apps/when-an-app-isnt-here#q-not-in-list).

## For developers

In the API, which calls apps pieces, Loop is `pieceId: "loop"` with `actionId: "loop_on_items"`. [Get an app](https://docs.gorunner.io/api/apps/get-app) returns every field.

It computes from its inputs only (`pure`). See [How versions and side effects work](https://docs.gorunner.io/apps#q-versions).

### Loop › Loop on Items

Iterate over each item in a list. Downstream steps receive `item`, `index`, and `iterations` from this step.

- **Items · Required**: Select the items to iterate over from a previous step, which should be a list of items.
- **Batch Size · Optional**: Items per iteration. With a size > 1, each iteration's `item` is an array (a batch) of up to this many items. Default: 1.
- **Max Iterations · Optional**: Safety cap: stop after this many iterations (0 = no limit). Applies after batching. Default: 0.
- **Iteration Timeout (seconds) · Optional**: Optional cap on how long one iteration may take, covering every step in the loop body. Leave blank for no cap. Each step still enforces its own timeout and the workflow timeout still applies.

Source: https://docs.gorunner.io/apps/loop
