---
title: "For Each Loop"
url: "https://docs.robotiq.ai/en/article/for-each-loop"
language: "en"
last_updated: "2025-12-24T14:59:22.471Z"
---

# For Each Loop

The For Each Loop step runs a block of code for each item in a list. You use it to process every item in an array or collection.

## How to Use the For Each Loop

Use this step to automate tasks that repeat for each item in a given list.

### Step 1: Add the For Each Loop Step

1.  Drag and drop the **For Each Loop** step into your process flow.
2.  Put the steps you want to repeat inside the For Each Loop block.

### Step 2: Set Up Input Parameters

Set up the loop to say which list to go through and where to put each item.

## Parameters Explained

**Step name** (Optional)

-   A custom name for the process step. This helps you find the step in the Process Editor.

**List** (Required)

-   The name of an existing variable that holds an array or list of items. The loop will process each item in this list.
-   **Example:** `myArrayOfNames`
-   **When to use it:** Always tell it which list you want to go through.

**Element variable** (Required)

-   The name of a variable where the current item from the list will be stored each time the loop runs.
-   **Example:** `currentItem`
-   **When to use it:** Use this variable inside the loop to work with one item at a time.

## Related Articles

-   [While Loop - Robotiq.ai Help Center](https://docs.robotiq.ai/en/article/while-loop)
-   [Do While - Robotiq.ai Help Center](https://docs.robotiq.ai/en/article/do-while)
-   [Set Variable Value Step - Robotiq.ai Help Center](https://docs.robotiq.ai/en/article/set-variable-value-step)

## Need Help?

Can't find what you're looking for? Join the [Robotiq Community](https://community.robotiq.ai/home/) to get help from other users and the Robotiq team.

![](https://cdn-assets.productfruits.com/3277cdc4-bc8c-42d2-88d4-8f541032b387)
