REPEAT

REPEAT

EXECUTES THE NEXT STATEMENT OR THE NEXT BLOCK OF STATEMENTS TO THE "UNTIL" COMMAND

  • Type: Command
  • Parameter: 0
  • Group: Structures

ACTION

The command is a part of the loop REPEAT/UNTIL, and is used to define the end of the statements to be executed when the logical condition is true.

While condition is true, all the statements till REPEAT are executed. Otherwise, the execution jumps to the statement just after UNTIL.

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 or not a statement or a block of statements.

Important remark: as the test of the looping condition is performed at the level of command UNTIL, all the statements between REPEAT and UNTIL are executed at least one time.

SYNTAX: REPEAT

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

USE

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

ERROR

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

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

UNTIL

AND

OR

NOT