Purpose
In order to organize a solution to a problem it is necessary to
express a strategy. Control structures enable the creation of strategies.
Control Structure Principles
The language supports several of the familiar Pascal style control
structures. Control structures are used to conditionally execute
certain instructions or to accomplish repeated execution of certain
instructions (iteration) with criteria to determine when the iteration
is completed.
Most control structures use the notion of a conditional expression.
Conditional expressions, when evaluated, will produce either a true/
false or yes/no type of answer. If this condition is true the program
behaves one way. If the condition is false it behaves another. The
following are examples of conditional expressions:
XAxis.ActualPosition > 2000
InputBit(1)
NumberOfPartsMade >= NumberOfPartsRequired
Conditional expressions often involve the following comparison
operators:
< less than
> greater than
<= less than or equal to
>= greater than or equal to
<> not equal to
= equal to
The basic logical operators AND, OR, XOR, and NOT are supported as well as compound conditional expressions.
RequiredPartsCompleted and NoNewBuildsRequested
not XAxis.MoveHasCompleted
UserAbort or SystemProblem
The following statement style is also legal in a conditional expression:
(XAxis.ActualPosition > 2000) and
(YAxis.ActualPosition < 1000)
This would need to be broken up into separate statements. A discussion of control structures now follows. Note also that the expressions do
not need to be in parenthesis unless it is needed, as above, to express precedence.