webCOMAND

cScript Flow Control

There are a number of ways to control the flow of cScript processing, including loops and conditions.

Example

// iterate based on an initial value, condition and incrementor
for($i = 1; $i < 3; $i++) {
    echo('Iteration $i\n');
}

// iterate over a collection of objects
foreach($collection as $object) {
    echo('Object OID $OID\n');
}

// loop based on a condition
local $i = 1;
while($i < 3) {
    echo('Iteration $i\n');
    $i++;
}