![]() |
![]() |
![]() |
![]() |
![]() |
|
Assignment expressions, like all expressions in Smalltalk, have values.
By convention, the value is the same as the value assigned. Thus, the
value produced by the expression y := 9 is 9.
Accordingly, assignment expressions can appear as subexpressions nested inside larger expressions.
In the following, for example, the assignment expression, y := 9,
which assigns a value to y, appears inside a larger assignment
expression, which assigns a value to x as well:
x := (y := 9)
When the assignment expression is evaluated, 9 is assigned to
y first; then, the value of the subexpression, which is also
9, is assigned to x.