REPCOUNT

Synopsis
REPCOUNT
Description

Outputs the number of the current repetition of a REPEAT command's instruction list. That is, it outputs 1 the first time the instruction list is run, outputs 2 the second time, and so on. REPCOUNT outputs -1 when it is run outside the context of a FOREVER or REPEAT command's instruction list.

If two REPEAT commands are nested, REPCOUNT outputs the repeat count of the innermost REPEAT.

Example
REPEAT 3 [PRINT (LIST "This "is "iteration REPCOUNT)]
This is iteration 1
This is iteration 2
This is iteration 3

SourceForge.net Logo