Until
Until ends a Repeat loop.
Syntax
Repeat
INSTRUCTION_LIST
Until EXPRESSION
INSTRUCTION_LISTis a list of instructions in a script.EXPRESSIONis a numeric expression that is considered as true if it is not equal to 0.
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
Until ends a Repeat loop if:
- A condition becomes true, that is the numeric expression returns a not null value.
- A break instruction is performed to interrupt the loop.
At least one iteration is done on the Repeat..Until loop, even if the condition is true when the loop starts. This is because the condition is evaluated only at Until statement.
Associated errors
| Error code | Description |
|---|---|
| 10 | The expression given after Until is not numeric. |
See also
For, To, Next, Step, Break, Repeat, While, Wend, If, Then, Else, Elsif, Endif.