FOR ... NEXT
This command, Logic control, is used to execute statement block until variable equals
terminating expression.
The syntax to be used for this command:
FOR <variable> = <start expression> TO <terminating expression>;
<statement block>
NEXT;
Possible scenarios:
- Successful loop
- Skip stepping into loop
- Exception cases
These are the examples of FOR ... NEXT command:
- Echo values 1 through
5
FOR $variable = 1 TO 5; Echo: $variable; NEXT;
- Echo values 10 through 15
$start_count = 10; FOR $variable = $start_count TO $start_count + 5; Echo: $variable; NEXT;