Previous IDL Reference Guide: Procedures and Functions Next

BREAK

Syntax | Examples | Version History

The BREAK statement provides a convenient way to immediately exit from a loop (FOR, WHILE, REPEAT), CASE, or SWITCH statement without resorting to GOTO statements.


Note
BREAK is an IDL statement. For information on using statements, see Program Control.

Syntax

BREAK

Examples

This example exits the enclosing WHILE loop when the value of i hits 5.

I = 0  
WHILE (1) DO BEGIN  
   i = i + 1  
   IF (i eq 5) THEN BREAK  
ENDWHILE  

Version History

5.4
Introduced

  IDL Online Help (March 06, 2007)