LOOP AS
LOOP AS $variable_name FROM start_expression | options_list
[TO end_expression]
[INCREMENT increment_expression] [ROW_COUNT $variable_name]
There are three types of option / counter loop:
- Literal Options List
LOOP AS $variable_name FROM "option 1, option 2, option 3" [ROW_COUNT $variable_name]
END_LOOP
- Options List from Variable
LOOP AS $variable_name FROM $options_variable_name [ROW_COUNT $variable_name]
END_LOOP
- Counter Loop
LOOP AS $variable_name FROM start_expression TO end_expression
[INCREMENT increment_expression]
[ROW_COUNT $variable_name]
END_LOOP
Examples:
LOOP AS $iLoopCounter FROM 1 TO 10 ROW_COUNT $iLoopCount
(commands go inside LOOP)
END_LOOP
LOOP AS $iLoopCounter FROM "Option 1,Option 2,Option 3" ROW_COUNT $iLoopCount
(commands go inside LOOP)
END_LOOP
$aryStrOptions = "Option 1,Option 2,Option 3"
LOOP AS $iLoopCounter FROM $aryStrOptions ROW_COUNT $iLoopCount
(commands go inside LOOP)
END_LOOP