4.2.1 Assign an Expression

Assignments can be made to variables, field references, pointers and arrays. Various assignments are describes according to the kind of information stored. The right hand side contains an Arithmetic Expression or a pointer reference. Type casts can be implicit or explicit type casts.


Assign an Expression Value

Transfer a value of a base type to a variable, field, or array element. The type of the Target is used to evaluate the Expression. Operands in the expression are implicitly cast to the type of the Target. Expliticit type cast functions can be applied to subexpressions.

Array indecies and many function arguments have established types. Array indecies are coerced to a Word. Function arguments are coerced to the type of their parameters. Some intrinsic functions adopt the type of their context as the type of the function and its arguments.

The type of an expression can be discerned by reading it from left to right. The type of a given operation can be determined unambiguously from its context. This obviates the need for mixed mode coersion tables for operators.


Care must be taken not to overflow this type when computing an index which has subexpression values that may cause an exception for this type. Consequently, it is advisable not to include such subexpressions in a range expression.


Copies a variable containing a user defined type into the variable on the left. Both variables must be of the same user defined type.

Enumeration variables may be assigned to another enumerated variable of the same type, an eumeration constant, or an unsigned integer constant or value. Note that enumeration constants are designated with a leading dot.


Variables with enumerated types may also be coerced to Integer type. The integer value of an enumerated variable is either zero or the position of the current value in the declaration of its type. An exception may occur when coercing to a byte and the current position exceeds 255.


The constant 0 can be assigned or compared for the null state. Other constants make sense only if integer type assignments are allowed. Micros can be assigned and in the case of ambiguity, the micro can be assigned. By limiting constants to 0 this is the only way ambiguity can lead to an error.


Operator Assignment

An operator can precede the equal sign in an assignment to perform the designated operation. It is applied between the target and the right hand side expression and the result is stored in the target. For a real number assignment operators limited to:  + - * / % ^


Assign an Address To a Pointer


Pointers can be used in inequalities to compare if they are equal, not equal, or null. A null pointer in assignments is coded, "@0". You can set the pointer to any 16 bit integer. hex? micro?


Conditional Assignment

You can also conditionally assign a variable, field, or array element to a value. Pointers cannot be conditionally assigned as it is too easy to make a mistake.


If the Condition is met then the True expression is assigned. Otherwise the False expression is assigned. If no True or False clause is coded the result is 1 if true or 0 if false.


Conditional Operator Assignment

When an Operator assignment is coded it is applied to the target value.


The append (!) and division operators (/, _/, %) are not allowed.

Procedure Body

Call a Method