for (roll option): Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Redirect pending split of article.)
 
mNo edit summary
Line 1: Line 1:
#REDIRECT [[Macros:Branching and Looping]]
{{stub}}
===FOR Option===
 
'''Introduced''': Version 1.3.b46
 
Executes a statement for a number of iterations based on a start and end value.
 
====Usage====
 
<source lang="mtmacro" line>
[FOR(var, start, end): body]
[FOR(var, start, end, stepsize): body]
[FOR(var, start, end, stepsize, separator): body]
</source>
 
The ''var'' variable counts from ''start'' to ''end'' during the loop. The optional ''stepsize'' (default +1) is added to var at each iteration.
 
====Example====
<source lang="mtmacro" line>
[FOR(i,10,0,-2): "i is now " + i]
</source>
 
Counts down even numbers from 10 to 0.
 
 
[[Category:Roll Option]]
[[Category:Roll Option]]
[[Category:Looping Roll Option]]
[[Category:Looping Roll Option]]

Revision as of 04:12, 5 April 2009

 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 to end during the loop. The optional stepsize (default +1) is added to var at each iteration.

Example

[FOR(i,10,0,-2): "i is now " + i]

Counts down even numbers from 10 to 0.