Skip to main content

While Loops

Cycle has the ability to repeat groups of Steps using While loops. The basic syntax and flow of a While loop is shown in the diagram below.

While loop

Cycle will repeat all the Steps between the While and the EndWhile keywords until the Conditional Step fails. When the conditional Step fails, execution will continue at the first Step after the EndWhile. The Feature File shown in the following figure will continue to prompt the user for a value until the user replies with a value not equal to Y.

Simple While loop

Any Step can be used as the Conditional Step of a While statement. This functionality allows you to create While Loops that are based on graphic images or even other Scenarios.

The figure below demonstrates using a graphic image for a Conditional Step. When executed, the script will stay in the While Loop until the Tryon Logo is no longer found when scanning the screen.

Simple While loop