for (roll option)
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
FOR Option
Introduced: Version 1.3.b46
Executes a statement for a number of iterations based on a start and end value.
Usage
[FOR(var, start, end): body]
[FOR(var, start, end, stepsize): body]
[FOR(var, start, end, stepsize, separator): body]
The var variable counts from start towards end during the loop, and the optional stepsize (default +1) is added to var at each iteration. Note that in the standard incrementing usage with a stepsize of 1, the body does not execute when var reaches end.
Example
[FOR(i,0,10): "i is now " + i]
Counts up from 0 to 9.
[FOR(i,10,0,-2): "i is now " + i]
Counts down even numbers from 10 to 0.
Version Changes
- 1.3b54 - Changed the comparison operator when comparing the var to end when determining whether to continue executing a new iteration. In b53 and earlier, on each iteration it compared if var was less than or equal to end. As of b54, it is now comparing if var is less than end.