![]() |
![]() |
![]() |
![]() |
![]() |
|
Of course, you can use parentheses to circumvent the precedence rules
by establishing subexpressions. In the following, for example, parentheses
are needed, because the unary printString message is to be sent to
the answer produced when the binary * message is sent:
Workspace Transcript show: (194 * 9) printString Transcript 1746
Without the parentheses, Smalltalk sends the printString message
to 9, which answers with a String instance, '9', which
cannot be an argument of the binary * message, inasmuch as you
cannot multiply an Integer instance times a String instance.