Message-ID: <31728FD1.4482@rwi.com>
Date: Mon, 15 Apr 1996 13:05:05 -0500
From: Rupert Bruce <rbruce@rwi.com>
Organization: RothWell international
X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/715)
MIME-Version: 1.0
Newsgroups: comp.lang.smalltalk
Subject: Re: Factorials in Smalltalk
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: quasar.rwi.com
Lines: 11
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!news.sprintlink.net!wally2.hti.net!

Netscape news has lost the thread for this (of course it's not my
fault!)

A recursive solution to calculating n!


!Factorial class methodsFor: 'instance creation'!

calculateFor: aNumber
	^(aNumber == 1)
		ifTrue:
			[ 1 ]
		ifFalse:
			[ aNumber * ( Factorial calculateFor: aNumber - 1) ]
