:= Operator

Changes the value of a variable or property.

Syntax

variable [ := variable ]… := value

Parts

variable
A variable or property that you can change. You can set many in one statement.
value
An expression of a data type compatible with variable.

Instructions

The element on the left side can be a scalar variable, a property, or an array element. The operator := sets the value of the variable on its left to the value on its right.

The operator := is almost the same as the operator = when used to change the value of a variable. The operator = can do one of two operations: (1) change the value of a variable or (2) do a test for equality. But the operator := is for assignment only.

Note: You can also use the operator := in procedure calls to pass arguments by name. See Passing Arguments by Position and by Name for more information.

Examples

Variable

The code that follows shows how a 3-D program can set its variables for x, y, and z to zero:

x := y := z := 0.0
After run
variablevalue
x0.0
y0.0
z0.0

Property

' Change value property
#obj.value := 42

See also