FOR

From Macros Wiki
Revision as of 21:21, 26 July 2010 by MikeO (talk | contribs)
Jump to navigationJump to search

Command

FOR <loop variable> = <start> TO <end> [STEP <step value>]


  • DESCRPTION*

Parameters

<loop variable>
A number variable.
<start>
Start value. The loop variable will initially be set to this start value
TO
used to separate the start and end values
<end>
End value. The loop will be repeated until the loop variable reaches this end value.
STEP
used to indicate that a step value other than 1 is to be used.
<value>
Step. Each time the loop is executed, the loop variable will modified by adding this step value.

Example

FOR I = 1 TO 3
FOR J = 2 TO 8 STEP 2


The first loop will execute 3 times, with I set to 1, 2 and 3.
The second loop will execute 4 times with J set to 2, 4, 6 and 8.