UNTIL

UNTIL C

EXECUTES AGAIN THE STATEMENT OR THE BLOCK OF STATEMENTS FROM REPEAT UNTIL THE CONDITION C IS TRUE

  • Type: Command
  • Parameter: 1
  • Group: Structures

ACTION

The command UNTIL defines the end of a loop REPEAT/UNTIL. It uses the result of the logical condition (True or False) to execute again or not the statement or the block of statements from the keyword REPEAT.

If the result is false, the loop is executed again.

If the result is true, the statement following UNTIL is executed.

The "condition" is a single logical expression (built with comparators >, <, >=, <>, =, ...) or a complex expression combined with logical operators AND, OR, NOT and parenthesis. Only the result (True or False) is used to execute again or not the the statement or the block of statements.

This command is the end of a loop and must be used with the command defining the beginning of the loop : REPEAT.

REPEAT

Statement(s)

UNTIL Condition

The statement or the block of statements till UNTILL is executed. Otherwise, the execution jumps to the statement just after UNTIL.

SYNTAX: UNTIL C

  • in:
  • REPEAT
  • Statement(s)
  • UNTIL C
  • C: logical expression.

USE

  • UNTIL is used, associated with REPEAT, to repeat one statement or a block of statements depending on a logical condition.

ERROR

  • If C is not a correct logical expression.
  • If there is no REPEAT before UNTIL.

EXAMPLE

dim a

a=0

rem display all the digits from 0 to 9

repeat

print a

a=a+1

until a=10

SEE ALSO

WHILE

END_WHILE

IF

THEN

ELSE

END_IF

REPEAT

AND

OR

NOT