Repeat

Repeat allows you to repeat a loop of instructions until a condition becomes true.

Syntax

Repeat
INSTRUCTION_LIST
Until EXPRESSION

Examples


  # Example 1 : let's perform a computation with successive approximations
  VARIA=INIT_VALUE
  Repeat
    VARIA=func ITERATE(VARIA)
  Until abs(func COMPUTE(VARIA)-TARGET)<EXPECTED_PRECISION


  # Example 2 : let's wait until the database is updated or until a limit hour is reached
  TIMEOUT="22:00:00"
  Repeat
    Sleep 1
    Break func DATABASE_UPDATED=1
 Until time$>=TIMEOUT

Description

Repeat allows you to perform loops until:

At least one iteration is performed on the loop, even if the condition is true when the loop starts. This is because the condition is evaluated only at the Until statement.

Associated errors

Error codeDescription
10The expression given after Until is not numeric.

See also

For, To, Next, Step, Break, Until, While, Wend, If, Then, Else, Elsif, Endif.