While

Purpose

The While is pretty similar to the Repeat command and can be used whenever you want to repeat a bunch of commands while a test expression is true.

To issue a While command you need the expression that will be calculated on every repetition to check (test) when to stop. We call this expression its test expression.

NOTE: The commands that you can insert inside a While are dictated by the surrounding context i.e. whether it is defined inside an exec or inside a group or at the top level.

Some example uses would be:

  1. You want to create a program that never ends (goes on forever until the athlete ends it). The natural thing to do is to use a While command with its test expression set to true.
  2. You want to repeat an Apply command until the athlete fails it

Definition

In order to issue a While command you have two options, either right-click and select New > While or press Space then N and finally W

While Definition

You must then enter the test expression its value dictating when the repetition will stop and click Save to create it. This will open the While command (you can open or close it just by clicking on the test expression) and reveal the list of its commands. This list starts empty but you can add as many commands as you want.

Execution

A While command will execute the list of its commands one by one and when the last one finishes it will then calculate its test expression and if the result is something else than false or nil it will repeat the same list of commands from the start. If the test expression result is false (or nil) it will not repeat the commands another time and the program will continue executing the command after the While.