Loop..Do

Description

"Loop..Do" constructs are used to perform a group of instructions a specific number of times. The syntax is:

Loop <numeric expression> do
  <statement>

The compiler makes a hidden temporary variable that counts from 1 to the numeric expression between the "Loop" and "Do" keywords. Although it is possible to have a function with a varying result be the numeric expression the design intention is for the loop value to be a constant. There are other better ways to make an indeterminate loop.

This is an example of a Loop..Do construct:


which produces this:


In a manner similar to the "If" construct if more than one statement needs to execute enclose that group of statements in a begin..end compound statement.


which results in