LOOP

LOOP is a CAOS command controlling flow.

Usage
LOOP marks the start of a block of code which is to be looped unboundedly. There are two types of unbounded loop in CAOS: LOOP..EVER and LOOP..UNTL.

..EVER
Syntax: ''LOOP .. EVER''

LOOP..EVER just repeats the same block of code over and over, until a STOP instruction is reached, or the script is interrupted (if running SLOW).

..UNTL
Syntax: ''LOOP .. UNTL cond (condition)''

LOOP..UNTL repeats the loop block, but at the end of each iteration cond is evaluated and if it is found to be true, the loop is terminated. STOP and interruptions still break out of the loop, as above.

This is a  loop in many programming languages. To simulate a  loop, you can wrap the whole thing in a DOIF.

Examples
This uses LOOP..UNTL to almost-replicate an ENUM loop, outputting UNIDs as it goes: SETA va00 NCLS NULL 0 0 0 TARG va00 LOOP OUTV UNID OUTS "\n" TARG NCLS TARG 0 0 0 UNTL TARG eq va00

LOOP..EVER can be used, and is in the Bootstrap, to continue doing something until a script interrupts.