Overview of Assignment Operators¶
The := operator replaces the value of an existing variable or member:
Equality uses ==, so an assignment is visually distinct from a comparison:
Declaration initialization¶
The same token appears in a declaration:
Here it initializes a new object through a constructor. Later uses such as
copy := score; assign an already-live object.
Compound assignment¶
Compound forms combine an operation with assignment:
Integer and BYTE values also have compound bitwise shifts, rotates, and
logical bit operations.
User-defined types¶
Structures receive generated memberwise assignment when their members support
it. A type can declare .OPERATOR:= when it needs a custom assignment contract.
Reference¶
Assignment changes a live object; it does not destroy and reconstruct it. For operator dispatch, generated assignment, compound spellings, and lifetime rules, see the Assignment Operators Reference.