Assignments

Syntax

variable := expression

Parameters

Description

Assignment statements are the preferred LDL+ format for implementing simple value manipulation and computational logic for non-primitive objects, rather than use of logic commands such as Add, Subtract, Multiply, Divide, and Move.

You cannot use assignment to assign a value to a Group. Groups are pseudo-primitive objects and special consideration must be used when assigning values. To assign a string value to a member of a group, use the Move command. To assign a value to a primitive member of a group, use assignment operator (:=).

The ':=" assignment operator sets the value of the target variable (LHS) to the value of the source expression (RHS). The precedence of the assignment operator is lower than that of all of the other operators in the source expression.

Note: Assignment between different groups is disallowed. Moves can be used for like as well as unlike types while assignment (:= ) can only be used for like types. This means, assignments should not be used on groups because they have different semantics.

Assignment statements pass by value. Pointers and references are not valid LDL+ constructs. Where a non-primitive object (for example, an instance of a class) is assigned to another non-primitive object it is done by means of a deep copy to ensure that the integrity of the target object is maintained.

You can also upcast or downcast a variable during an assignment. Refer to Casting Operators for more information.

For external binary large objects (BLOBs), assignment copies the contents of the source file (External Blob) to the destination file (External Blob). For example, DestBlob := SourceBlob will copy the file associated with the pathname defined in SourceBlob (source file) to the file associated with the pathname defined in DestBlob (destination file). If the file associated with the pathname in SourceBlob is not available or the copy fails then Glb.Status is set to '*****'. If the file name associated with the pathname DestBlob is invalid then Glb.Status will be '*****'. If the file associated with the pathname in DestBlob already exists it is overwritten.

Examples

Example 1

MyString := "Go ahead" & " - make my day!"

Example 2

MyBool := A = B

Example 3

MyNum := (A * 34) + (B / 5)