Assignment Statement
Dealing card games with the old men in the club car...
Penny a point, ain't noone keepin' score.
Pass the paper bag that holds the bottle...
Feel the wheels rumbling 'neath the floor.
- Steve Goodman
The Assignment statement sets the value for a single target identifier by assigning it the value of the specified expression. The following table shows the syntax for the assignment statement.
♦ Where ‘TargetIdentifier’ is a valid data identifier (module level, class level or local) and ‘Expression’ is a valid Aztec expression with a data type which matches or is consistent with the target identifier.
♦ The assignment statement can be used at the module level and class level for compile-time logic, and at the method level for run-time logic.
♦ If used at the module or class level, the target identifier must be marked with the ‘compiler’ keyword and each term in the expression must either be a constant or also marked with ‘compiler’ (data or method call).
♦ For a primitive target identifier used as a “value” (no ‘@’), the expression data type must match the identifier exactly. The only exception is an integer expression being assigned to a floating point target, the system automatically converts the int to a float.
♦ For target identifier used as a “reference”, the data type of the expression must satisfy the standard OO “is a” relationship with the target identifier.
♦ Assignment statements can not be chained ("a=b=c" is not valid syntax).
♦ A corollary to this rule is that the assignment statement itself does not return a value. This means that an assignment using a boolean target can not be mistakenly used where a conditional expression is needed. In other words, the syntax "if ( IsValid = GetBoolValue() )" is invalid. The expression must be boolean, and since the boolean assignment itself does not return a value, it is not valid.