[Yandex Cloud documentation](../../../../index.md) > [Yandex Serverless Integrations](../../../index.md) > [Step-by-step guides](../../index.md) > Workflows > [Workflow step constructor](index.md) > Control steps > While

# Adding the While loop

You can use the While control step to set a sequence of steps to apply within a loop. The step will apply while the condition from **Execution condition template** is true, but only as many times as set in **Maximum number of iterations**. If no condition is set, the step is performed the specified number of times. If the number of iterations is not specified, the loop will continue until the condition is no longer met or the workflow [timeout](../../../concepts/limits.md) is reached.

Each execution branch within the While step (including all [Switch](switch.md) steps) must contain an [integration](index.md#integration-steps) step or a [Success](success.md), [Fail](fail.md), or [Wait](wait.md) step.

{% list tabs %}

- Management console {#console}

  1. When [creating](../workflow/create-constructor.md) a new workflow or [editing](../workflow/update.md) an existing one, in the management console, under **Create workflow** / **Edit workflow**, select `Constructor`. 
  1. From the **Control steps** section on the left side of the screen, drag the ![arrows-rotate-right](../../../../_assets/console-icons/arrows-rotate-right.svg) **While** element to the relevant workflow location in the constructor window.

      You can drag and drop steps into areas marked by the dotted line in the workflow schema, such as **Add a step**, etc.
  1. In the workflow schema window, click the added **While** section to select it.
  1. At the right of the window, on the **Settings** tab.

      1. In the **Step name** field, enter a name for the workflow step.
      1. In the **Execution condition template** field, specify a condition in jq format that returns either the `true` or `false` string. This is a required field if the **Maximum number of iterations** field is not set.
      1. In the **Maximum number of iterations** field, specify the maximum number of iterations the loop can complete. This is a required field if the **Execution condition template** value is not set.
  1. Optionally, navigate to the **Input** tab and set a [jq template](../../../concepts/workflows/templating.md) to filter the [workflow state](../../../concepts/workflows/workflow.md#state) fed into the step.
  1. Optionally, navigate to the **Output** tab and set a [jq template](../../../concepts/workflows/templating.md) to filter the step outputs added into the [workflow state](../../../concepts/workflows/workflow.md#state).
  1. To add a new step to an execution branch, drag the step you need from **Integration steps** or **Control steps** to the area marked by the dotted line within the branch.

{% endlist %}

## Useful links {#see-also}

* [YaWL specification](../../../concepts/workflows/yawl/management/while.md)
* [Creating a workflow using the constructor](../workflow/create-constructor.md)
* [Updating a workflow](../workflow/update.md)