Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
FOR, TO, and DOWNTO Keywords
◄Keywords► ◄Contents► ◄Index► ◄Back►
FOR <control variable> := <expression> TO │ DOWNTO
<expression>
DO <statement>
Description
A FOR statement is a loop that repeats a specified number of
times. The range of two expressions controls the number of loops.
For each loop, a control variable changes in value. During the
first loop, the control variable takes the value of the first
expression. For the successive loops, the value of the control
variable increments or decrements by one until the control variable
is equal to the second expression.
If the TO key word is used, the value of the control variable
increments. If the DOWNTO keyword is used, the value of the control
variable decrements.
See also: Pascal Statement Hierarchy, Loop, REPEAT, WHILE