Executes a sequence of commands while incrementing a variable a
specified number of times.
Format
FOR name=expression1 TO expression2 [BY expression3]
DO (command[; . . . ])
1 – Parameters
name
Specifies the name of a count variable.
expression1
Specifies an integer or enumeration type value. The expression1
and expression2 parameters must be of the same type.
expression2
Specifies an integer or enumeration type value. The expression1
and expression2 parameters must be of the same type.
expression3
Specifies an integer.
command
Specifies a debugger command. If you specify more than one
command, you must separate the commands with semicolons. At each
execution, the debugger checks the syntax of any expressions in
the commands and then evaluates them.
2 – Description
The behavior of the FOR command depends on the value of the
expression3 parameter, as detailed in the following table:
expression3Action of the FOR Command
Positive name parameter is incremented from the value of
expression1 by the value of expression3 until it is
greater than the value of expression2
Negative name is decremented from the value of expression1 by
the value of expression3 until it is less than the
value of expression2
0 The debugger returns an error message
Omitted The debugger assumes it to have the value +1
Related commands:
EXITLOOP
REPEAT
WHILE
3 – Examples
1.DBG> FOR I = 10 TO 1 BY -1 DO (EXAMINE A(I))
This command examines an array backwards.
2.DBG> FOR I = 1 TO 10 DO (DEPOSIT A(I) = 0)
This command initializes an array to zero.