Anonymous user
Category:Smalltalk: Difference between revisions
→A Word About Code Snippets in Rosetta
Line 555:
].
factorial value:10</lang>
(here there is no self, and the code works anywhere outside any class context. A block (aka 'function') is assigned to the "factorial" variable; the <tt>value
The advantage is that this code can be simply selected as a whole and evaluated. Any variables created will be local to the evaluation scope and not infect the system.
Line 561:
The disadvantage is that it might look somewhat non-Smalltalk-like to not have it in a class/method.
However, it shows that Smalltalk
==Citations==
|