# Loop over a list of items

Run the same steps once for each item in a list, then carry on with the rest of your flow.

Source: https://support.rework.com/article/loop-over-a-list-of-items

Some steps produce a list rather than a single thing: the invoices that are still open, the rows in a sheet, the records that match a search. The **Loop** step runs the steps inside it once for each item in that list, then continues the flow once at the end.

## Step 1: Add the loop and give it a list

- Click the **+** where the repetition should start and pick **Loop**.
  
- Open it and fill in **items** with the list: a token from an earlier step, for example the records an earlier step returned, or a JSON array typed by hand.
  

![The Loop step with its items field, the loop body and the after loop marker](https://storage.googleapis.com/reworkv3-public/success/260923/RfT0jUdW0SSprNN5bQUqPfwoyTVqArb58eLngQjVSfS03guSCKLRm45puxTozlVS/img.bh4lSEe9gSnLgaKbCkNbZap6HuwmaZjsiEuR26rb35nctqi5iDZLVfDuLMZsne81.png)

The canvas now shows two things worth knowing:

- **Loop body**: the dashed frame around the steps that run once per item.
  
- **After loop**: the point where the flow carries on, once, after the last item.
  

## Step 2: Put steps inside the loop

Add steps inside the frame the same way as anywhere else. Inside the body you can use the current item in any field, for example `{{each.item.number}}` when your loop step is named _each_.

![A Send email step inside the loop, using the current item in its subject and body](https://storage.googleapis.com/reworkv3-public/success/260923/ghajn3N0jG6NYEZgOLjsDMnolT6btFFzxanHFX3NqLVeLzt3YV1rntmk7PK7RuO8/img.l3CETxag8cJ1gJNOucz2bgHZNLHUfNYpivsztEF2Bxq8YVn9iuR7XYWgAaAUjbvT.png)

A filter inside the body applies to that item only: the run skips the rest of the body for that item and moves on to the next. The loop itself keeps going.

## Step 3: Continue after the loop

Steps placed after the **After loop** marker run once, when every item has been through the body. 💡 This is where a summary belongs, for example a single digest email rather than one message per item.

## Step 4: Read a loop in a run

In a finished run, the loop shows how many times it went round, and a step inside the body keeps one result per round. Open such a step and use the arrows in its result panel to move between rounds.

![A finished run showing the loop with three rounds and the step after the loop](https://storage.googleapis.com/reworkv3-public/success/260923/24n3JwpcEGQ5CWZfYmQAvXDg0ISbxkwG5CIdJzNXMPi9VsFmIREo55mFEef9lYUB/img.Ut3QYnTgNK5fuME1BpucOfl3ZLcSKbRwJqzHFNJKzwPCrc9GgF3UdLB9OI0FLJ1R.png)

See [Read a run step by step](https://support.rework.com/article/read-a-run-step-by-step).

> **Note:** A loop doesn't need a **Merge**. Its own **After loop** path is the continuation, which is why a flow with a loop still ends on a single path. See [How a flow is shaped](https://support.rework.com/article/how-a-flow-is-shaped).
