Arbortext IsoDraw > Macro Language Reference > Introduction > Language Basics > Flow Control Statements > For
  
For
The FOR statement is similar to the WHILE statement, except that it adds counter initialization and counter manipulation expressions.
FORcounter=from-expressionTOto-expressionSTEPstep-counterstatementsEND FOR
counter
Counter variable.
from-expression
Start of valid range of counter values.
to-expression
End of valid range of counter values.
step-counter
Amount to increment counter for each loop.
statements
One or more Arbortext IsoDraw Macro Language statements.
DEFINE i AS integer
FOR i = 0 TO 90
CREATE ELLIPSE 300 200 100 180 i
CREATE ELLIPSE 300 200 100 90 i
END FOR
DEFINE i AS integer
DEFINE j AS integer
j=90
FOR i = 0 TO j STEP 5
CREATE ELLIPSE 300 200 100 180 i
CREATE ELLIPSE 300 200 100 90 i
END FOR
Although the FOR statement is similar to the WHILE statement it is often shorter and easier to read than the equivalent WHILE loop. For example a WHILE loop that counts from 1 to 10 and prints the numbers in a message window:
DEFINE number AS integer
number = 1
WHILE (number <= 10)
MESSAGE "The number is now " + number
number = number + 1
END WHILE
Here’s the corresponding for loop:
DEFINE number AS integer
FOR number = 1 TO 10
MESSAGE "The number is now " + number
END FOR