Alertra Script Language 1.9
for
The for loop allows iteration a fixed number of times. Note that scripts will only execute a maximum of 5,000 commands before generating a runtime error. This is to keep any script from running out of control.
You can use the 'begin' keyword in place of the statement to execute multiple commands on each iteration. Be sure to terminate the loop with an 'end' statement:
for X = 1 to 5 begin .... end
usage: for [target] = [expr1] to [expr2] [step [expr3]] [statement] [;] [statement...]
parameters:
req | name | type | description |
---|---|---|---|
Y | target | variable | Variable to receive the value of each iteration |
Y | expr1 | expression | The starting index of the loop |
Y | expr2 | expression | The ending index of the loop |
N | expr3 | expression | The increment to use each iteration (defaults to 1, can be negative) |
Y | statement | statement | The command(s) to execute on each iteration of the loop |
examples
for X = 1 to 5 http get "/execute.php?cmd=" + $X
Interate from 1 to 5, assigning the value of each iteration to X. On each iteration, execute an http statement giving the value of X to the server script being executed.
for X = 5 to 1 step -1 http get "/execute.php?cmd=" + $X
Interate from 5 to 1, assigning the value of each iteration to X. On each iteration, execute an http statement giving the value of X to the server script being executed.
Alertra Script Language: Language Reference