The while: command conditionally repeats a sequence of actions. This can implement controlled infinite loops for interactions and timers.



start:
  set:
    counter: 0
  while:
    if@bool: {{counter < 5 ? 'yes'}}
    do:
      set:
        counter: {{counter+1}}
  return:
    counter@key: counter



counter: 5

Syntax

if:

The if@bool: key must resolve to a boolean value.

While true, the commands in do: are repeatedly executed.

If false, the while-loop terminates.

do:

The do: key contains any number of commands to repeat.