DOIF

DOIF is a CAOS command controlling flow.

Usage
Syntax: DOIF cond (condition) ..

DOIF is part of a set of commands used for conditional execution of code. It marks the start of a code block to execute if cond is true. It must be followed by another conditional execution marker: ELIF, ELSE or ENDI.

Some valid patterns for DOIF.. code are: where .. indicates a code block for execution under conditions.
 * DOIF .. ENDI
 * DOIF .. ELSE .. ENDI
 * DOIF .. ELIF .. (ELIF ..) ENDI
 * DOIF .. ELIF .. (ELIF ..) ELSE .. ENDI

Examples
Here is a simple way of using DOIF and its confederates. If the current pose is 0, change it to 1; if it is 3, change it to 2; in any other case, change it to 5. DOIF POSE eq 0 POSE 1 ELIF POSE eq 3 POSE 2 ELSE POSE 5 ENDI
 * change an agent's pose depending on how it looks now.

DOIF is an important part of the CAOS language and many examples for other commands and functions use it. For instance, see the ROT13 script on CHAR, the implementation of SINS, and the third example in ATTR.