Anonymous user
Category:Smalltalk: Difference between revisions
→A Word About Code Snippets in Rosetta
(One intermediate revision by the same user not shown) | |||
Line 639:
ifTrue:[1]
ifFalse:[ self * (self-1) factorial ]</lang>
(here '<I>self</I>' is the Integer receiver object, and " ˆ " returns a value from the message send).
To get the factorial value, we'd evaluate in a workspace:<lang>10 factorial</lang>
Line 650:
a) is somewhat inconvenient if the code example consists of multiple methods, possibly in multiple classes.
<br>b) comes with the additional trouble that fileIn formats are different (chunk file, vs. XML file, vs. Monticello, vs. GNU-ST etc.).
For example, for export/import, GNU-ST uses a ''private format'',
<lang smalltalk>Number extend [
my_factorial [
|