# Workflow\.dowhile() The `.dowhile()` method executes a step while a condition is met. It always runs the step at least once before evaluating the condition. The first time the condition is evaluated, `iterationCount` is `1`. ## Usage example ```typescript workflow.dowhile(step1, async ({ inputData }) => true) ``` ## Parameters **step** (`Step`): The step instance to execute in the loop **condition** (`(params : ExecuteParams & { iterationCount: number }) => Promise`): A function that returns a boolean indicating whether to continue the loop. The function receives the execution parameters and the iteration count. ## Returns **workflow** (`Workflow`): The workflow instance for method chaining ## Related - [Control Flow](https://mastra.ai/docs/workflows/control-flow) - [ExecuteParams](https://mastra.ai/reference/workflows/step)