In the above examples ``anObject'' is a named variable, which contains a reference to an object. Through variables we communicate with objects.
Variables are initialised with the id of (or a reference to) an object at the time of their creation.
|
myAge := 17. " implicit creation of a number object " anObject := NSSet new. " explicitly create an object by calling new on its class " myString := 'this is indeed a string' . " implicit creation of a string object "
|
The evaluation of the right part (as complex it might be) is a reference to an object in any case. This evaluation is stored in the named variable as stated on the left part. The assignment operator ``:='', which assigns the right side to the left side, is special and distinguishes from ``='', which is an evaluation operator testing for equality/identity.