Previous IDL Reference Guide: Procedures and Functions Next

WHILE...DO

Syntax | Examples | Version History

The WHILE...DO statement performs its subject statement(s) as long as the expression evaluates to true. The subject is never executed if the condition is initially false.


Note
For information on using WHILE...DO and other IDL program control statements, see Program Control.

Syntax

WHILE expression DO statement

or

WHILE expression DO BEGIN

   statements

ENDWHILE

Examples

i = 0  
WHILE (i EQ 1) DO PRINT, i  

Because the expression (which is false in this case) is evaluated before the subject statement is executed, this code yields no output.

Version History

Original
Introduced

  IDL Online Help (March 06, 2007)