Routines (alphabetical) > Routines: C > CONTINUE

CONTINUE

Syntax | Examples | Version History | See Also

The CONTINUE statement provides a convenient way to immediately start the next iteration of the enclosing FOR, FOREACH, WHILE, or REPEAT loop.

Note: Do not confuse the CONTINUE statement described here with the .CONTINUE executive command. The two constructs are not related, and serve completely different purposes.

Note: CONTINUE is not allowed within CASE or SWITCH statements. This is in contrast with the C language, which does allow this.

Syntax

CONTINUE

Examples

This example presents one way (not necessarily the best) to print the even numbers between 1 and 10.

FOR I = 1,10 DO BEGIN

   ; If odd, start next iteration:

   IF (I AND 1) THEN CONTINUE

   PRINT, I

ENDFOR

Version History

5.4

Introduced

See Also

BEGIN...END , BREAK , CASE , FOR , FOREACH, GOTO , IF...THEN...ELSE , REPEAT...UNTIL , SWITCH , WHILE...DO

IDL Programming