:= Operator

Assigns a value to a variable or property.

Syntax

variable := value

Parts

variable
Required. Any modifyable variable or property.
value
Required. Any expression of a type compatible with variable.

Remarks

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

The := operator acts like the = operator to assign a new value to a variable, except that := offers more flexibility in its placement. Unlike the = operator, the := operator's only function is assignment; whereas, the = operator can represent either assignment or comparison, depending on context.

Examples

Variable

The following code shows how a 3-D application can zero out its x, y, and z variables:

Listing 1
x := y := z := 0
After execution
variablevalue
x0
y0
z0

Property

Listing 2
' Change value property
#obj.value := 42

See also