Category:Smalltalk: Difference between revisions

Content added Content deleted
Line 639: Line 639:
ifTrue:[1]
ifTrue:[1]
ifFalse:[ self * (self-1) factorial ]</lang>
ifFalse:[ self * (self-1) factorial ]</lang>
(here 'self' is the Integer receiver object, and "ˆ" returns a value from the message send).
(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>
To get the factorial value, we'd evaluate in a workspace:<lang>10 factorial</lang>