REPEAT...UNTIL

Syntax | Examples | Version History | See Also

The REPEAT...UNTIL statement repeats its subject statement(s) until an expression evaluates to true. The condition is checked after the subject statement is executed. Therefore, the subject statement is always executed at least once, even if the expression evaluates to true the first time.

Note
For information on using REPEAT_UNTIL and other IDL program control statements, see Program Control (Application Programming).

Syntax

REPEAT statement UNTIL expression

or

REPEAT BEGIN

   statements

ENDREP UNTIL expression

Examples

This example shows that because the subject of a REPEAT statement is evaluated before the expression, it is always executed at least once:

i = 1

REPEAT BEGIN

   PRINT, i

ENDREP UNTIL (i EQ 1)

Version History

Original

Introduced

See Also

BEGIN...END, BREAK, CASE, CONTINUE, FOR, GOTO, IF...THEN...ELSE, SWITCH, WHILE...DO, Program Control (Application Programming)