> For the complete documentation index, see [llms.txt](https://docs.avoautomation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avoautomation.com/avo-assure/actions/generic/loops-and-condition-operations-1/for.md).

# 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**:

* 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

**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="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FsDoUo36QZdoKh88Kwr8l%2Funknown.png?alt=media&amp;token=44425292-f65e-4db2-a67e-b9508673faef" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
