Chapter 3 The Application Description Language

3.8 Assignment

Assignment statements allow you to assign new values to declared variables of base (Section 3.3, "Base Types" page 14) and compound types (Section 3.5, "Compound Types" page 16). You can use any such declared variable as an lvalue in an assignment. When you copy a string or list in an assignment, you perform a deep copy. When you make an assignment to a previously initialized string or list, you destroy the previous contents.
Sample Assignments
buttonWidth = 'GetWidth => myButton;
buttonWidth = 2 * buttonWidth;

Declared objects are neither base nor compound system types, and hence an identifier declared to name an object cannot receive an assignment. Handles, however, are a base system type and a variable declared as a handle can receive a handle to an object in assignment statements.

Note that unlike C and C++ there is no assignment operator, and assignment cannot be a subexpression. There are no compound assignment operators like(+=). The lvalue determining the target of the assignment is guaranteed to be evaluated after the expression on the right side of the assignment statement (see Section 3.11, "Type Conversion" page 28 for a discussion of type conversion in assignment).


AM2 Documentation - 19 NOV 1996

Generated with Harlequin WebMaker