Assigns a value to a variable or property.
variable = value
- Required. Any modifyable variable or property.
- Required. Any expression of a type compatible with variable.
The element on the left side of the equals sign (=) 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.
|Note||Do not confuse this = operator with the = comparison operator. For the latter, see the Comparison Operators article.|
Because of the language's overloading of this operator, the = operator is the only assignment operator that cannot be chained in a single assignment statement, except as the first. The := operator is much more reliable for this purpose.
The following example demonstrates the use of = as an assignment operator and comparison operator in the same statement:
Dim x, y 'x and y are initially zero x = y = 0 ' y is being tested for equality to zero
' Change value of property #obj.value = 42