# While

The While action is a type of loop that will evaluate a specified condition either at the beginning or at the end of each iteration, and that will continue to loop whilst the condition is true.

***

### Properties

* **Condition**\
  The condition that will determine whether the loop will continue or not.
* **Test**\
  Select 'Before' if you want the condition to be tested before the next loop iteration. Select 'After' if you want the condition to be tested after each loop iteration.

  Use 'After' when you want to execute the body of the loop at least once, even if the condition fails.

### How to create a While loop

1. Drag a While action onto the canvas.
2. Set the Condition property by adding a condition expression.
3. Set the Test property by selecting either 'Before' or After'.
4. Drag onto your While action's loop sub-section all the actions that must execute in each loop iteration, e.g. [SetValue ](/actions/set-value.md).

![](/files/PiT6F1xlNj3tDVcM5DhE)


---

# 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.stadium.software/actions/while.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.
