# For each item

> Run the steps that follow once for every item of a list.

Source: https://docs.buildcord.dev/nodes/flow-control/for-each/

`flow.forEach` runs the steps wired to **Each item** once per item of a list, then continues from **When finished**. It can't fail.

## Settings

| Setting | What it does |
| --- | --- |
| List | The list, such as `{var.bannedWords}` or `{option.names}`. |
| Items are separated by | **Commas** or **New lines**. |

## Ways out

| Way out | Taken when |
| --- | --- |
| `Each item` | For every item. Wire it to the steps to repeat. |
| `When finished` | After the last item. |

## Produces

`{loop.item}`, the item this pass is for, and `{loop.index}`, its position from 1.

## Notes

- Blank items are skipped, so `a,,b` is two items.
- At most 500 items.
- To go through rows of a collection, use [For each row](https://docs.buildcord.dev/nodes/variables-and-data/for-each-row).

## Example

Check a message against each word in `{var.bannedWords}` and [stop the loop](https://docs.buildcord.dev/nodes/flow-control/stop-loop) at the first match. (A [Message check](https://docs.buildcord.dev/nodes/conditions/message-check) does this in one step.)

## Related

- [Repeat](https://docs.buildcord.dev/nodes/flow-control/repeat)
- [Change a list](https://docs.buildcord.dev/nodes/variables-and-data/change-list)
