+LOOP


Next: +STO Up: COD Command Summary Previous: +

+LOOP

Terminate a COD FOR loop. When this statement executes, the number at the top of the stack is added to the current index. The loop terminates when the index passes the limit value. The +LOOP statement allows for loops in which the index value can either increase or decrease. This word can only be used in colon definitions.

Example:

COD> : TMP 0 2 FOR I . -1 +LOOP ;

COD> TMP
 2.0
 1.0
 0.0

COD> : DOUBLE 100 1 FOR I . I +LOOP ;

COD> DOUBLE
 1.0
 2.0
 4.0
 8.0
 16.0
 32.0
 64.0



Web Page Maintained by: Dr. Lawrence E. Brown elwin@redshift.gsfc.nasa.gov