The ASSIGNMENT statement causes the item on the right of the assignment operator (:=) to be evaluated and the resulting value to be assigned to the item on the left of the assignment operator.
<assignment statement>
──┬─<arithmetic assignment>─────────────────┬──────────────────────────┤ ├─<array reference assignment>────────────┤ ├─<Boolean assignment>────────────────────┤ ├─<complex assignment>────────────────────┤ ├─<connection block reference assignment>─┤ ├─<mnemonic attribute assignment>─────────┤ ├─<pointer assignment>────────────────────┤ ├─<procedure reference array assignment>──┤ ├─<string assignment>─────────────────────┤ ├─<structure block reference assignment>──┤ └─<task assignment>───────────────────────┘
The action of an ASSIGNMENT statement is as follows:
-
The location of the target is determined.
-
The item following the assignment operator (:=) is evaluated.
-
The resulting value is assigned to the target.
The various forms of the ASSIGNMENT statement are called assignments instead of statements because they can appear both as statements and in expressions. For example, the following is a statement when it stands alone:
A := A + 1
However, the same construct can be used in an expression, such as in the following:
IF (A := A + 1) > 100 THEN <statement>
Too many arithmetic, Boolean, complex, pointer, or string assignments in one statement can cause a stack overflow fault in the compiler. The fault can be avoided by breaking the statement into several separate statements, each containing fewer assignments, or by increasing the maximum stack size for the program by using the task attribute STACKLIMIT.

