89
This expression...
... resolves to this value.
3+=“6”
Illegal (L-Value not a
Variable)
Subtraction Assignment (-=) Operator
The subtraction assignment operator works with both numerical values and strings values. Use this
operator with strings to remove a sub-string from a string Variable, or use this operator to subtract an
integer value from a numeric Variable.
For example, assuming
MyNumber
has an integer value of
4
, and
MyString
has a value of
“Hello”
:
This expression...
... resolves to this value.
MyNumber-=1
3 (MyNumber also
contains 3)
MyString-=“ll”
“Heo” (MyString also
contains “Heo”)
10-=“3”
Illegal (L-Value not a
Variable)
Multiplication Assignment (*=) Operator
This operator multiplies two numbers, or can be used for creating a string with a repeating value. The
numbers and strings can be either Variables or literals.
For example, assuming
MyNumber
has an integer value of
4
, and
MyString
has a value of
“Hello”
:
This expression...
... resolves to this value.
MyNumber*=5
20 (MyNumber set to 20)
MyString*=3
“HelloHelloHello”
(MyString same as
result)
3*=5
Illegal (L-Value not a
Variable)
Division Assignment (/=) Operator
The divide operator is valid only for numerical values and Variables. Use this operator to divide one
numerical value by another. The resultant type is an integer value. Division by 0 results in a return value
of 0.
For example, assuming
MyNumber
has an integer value of
4
: