Skip to main content

While Loops

While loops execute a sequence of code indefinitely until the user cancels or a step set to Early Stop stops.

How to stop a While loop​

The loop will continue to run until canceled, there are 3 ways to stop a while loop:

  • Cancel manually
  • Early Stop/Break for loop
  • Early Stop for Step

Cancel manually​

You can cancel flow manually from the flow page, it can be accessed when the flow is triggered manually or from the Runs page.

Early Stop / Break​

The Early Stop/Break feature allows you to define a predicate expression that determines whether the flow - or here, loop - should stop early at the end or before a step.


Early Stop for Step​

For each step of the flow, an early stop can be defined. The result of the step will be compared to a previously defined predicate expression, and if the condition is met, the flow will stop after that step.


Skip failure​

If set to true, the loop will continue to the next item even if the current item failed.

Test an iteration​

You can get a test of the current iteration by clicking on the Test an iteration button.

Advanced Settings​

Early Stop / Break​

See above.

Suspend/Approval/Prompt​

Flows can be suspended until resumed or canceled event(s) are received. This feature is most useful for implementing approval steps but can be used for other purposes as well.

Sleep​

Executions within a flow can be suspended for a given time.

Mock​

Step mocking allows faster iteration while building flows. When a step is mocked, it will immediately return the mocked value without performing any computation.

Lifetime​

The logs, arguments and results of this flow step will be completely deleted from Windmill once the flow is complete.