# For

This is a pre-built Action located under the **@Generic Element**. The functionality of this action in Avo Assure is to iterate the specified block of test steps based on the number provided in the input column. The result is stored in the given dynamic variable for further use during test execution.

{% hint style="info" %}
**Note**:&#x20;

* The **For** action requires a corresponding **End-For** action to properly close the loop. If the **End-For** action is missing, the client displays a dangling error and the Test case fails.
* The **For** condition supports nested looping and iterates across multiple levels of data. It also allows the loop index to start from 1.
  {% endhint %}

## Syntax  &#x20;

**Input Value**:  `<number>`

| Argument                       | Description                                          |
| ------------------------------ | ---------------------------------------------------- |
| <p>\<number><br>(Required)</p> | Provide the number of times the loop should iterate. |

**Output Value**: `<Dynamic Variable>;<Dynamic Variable>(Optional)`

| Argument                                 | Description                                                       |
| ---------------------------------------- | ----------------------------------------------------------------- |
| <p>\<Dynamic Variable><br>(Required)</p> | This dynamic variable stores iteration count.                     |
| <p>\<Dynamic Variable><br>(Optional)</p> | This dynamic variable stores the status as **True** or **False**. |

### **Example : Starting a Loop for a Defined Number of Iterations**

In this example, we explain how to begin a loop that repeats a specific number of times.

* **Action**: For
* **Input Value**: 5
  * The argument (**5**) specifies the number of iterations for the loop. This defines how many times the actions inside the For block will be executed during test execution.
* **Output Value**: {Status}
  * The result of iteration count (5) is stores in the **{Count}** variable.
  * If a second output variable is defined, then it stores the action status with the following possible values:
    * **True**: If the loop starts and executes successfully.
    * **False**: If the loop does not start.
* **Logical Explanation**: The **For** action reads the value from the **Input Value** column (**5**) and starts a loop that repeats the enclosed steps exactly five times. Each iteration executes the actions inside the For block sequentially. After completing the defined number of iterations, the flow continues with the steps that follow the **End-For** action. The result of iteration count (5) is stores in the **{Count}** variable.

<figure><img src="/files/Lqk5m6NkhEjo9pG1oRUW" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/loops-and-condition-operations-1/for.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
