The assignment operator = can be used to declare and initialize a
local variable, or update the value of an existing variable.
The operand on the left side of the
= sign is called the lvalue. The most common lvalue is an identifier.
If it is an identifier that does not coincide with any
local variable's name, a new local variable with this name will be created and
initialized. Otherwise the existing variable by that name will be reset to
the value given on the right hand side of =.
When assignment a = b is carried out, the variable a obtains a
copy of
b, and the two values are now independent. For example
>> b = (2, 3, 5);
>> a = b;
>> a # 2 = -3;
>> a
(2, -3, 5)
>> b
(2, 3, 5)
Two variables can never refer to the same object, or in other words,
one object cannot have two different names. This is quite unlike programming languages
that store references instead of values in variables.
oz
2009-12-22