Repeat...until...

Program flow management function.

The Repeat...until structure defines a loop with a completion check at the end of the loop.

Usage

Used to repeat the same steps a certain number of times or until a condition is true.

Syntax

Repeat
 <statements>
Until <boolean_expression>

Parameters

<statements>: statements to be executed until <boolean_expression> becomes true.

Remarks

In a REPEAT statement (unlike a While statement), <statements> are always executed at least once.

If PAUSE n SECS or PAUSE n TICKS is the last line before UNTIL, use the statement EndPause to close this Pause block, or the compiler will generate the error message Invalid Pause ... Until.

See also

Logical operators

Example

 

a = 0

Repeat

  beep (100)

  a = a + 1

  pause 300 ticks ' same as 3 seconds
  EndPause
Until a = 5