[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PIL 3rd electronic version
- From: Finn Wilcox <finnw@...>
- Date: Wed, 15 May 2013 10:07:37 +0100
> On Wed, May 15, 2013 at 5:26 AM, Steve Litt <slitt@troubleshooters.com
> <mailto:slitt@troubleshooters.com>> wrote:
>
> ✲✲ ❞❡❢✐♥❡s ❛ ❢❛❝t♦r✐❛❧ ❢✉♥❝t✐♦♥
> ❢✉♥❝t✐♦♥ ❢❛❝t ✭♥✮
> ✐❢ ♥ ❂❂ ✵ t❤❡♥
> r❡t✉r♥ ✶
> ❡❧s❡
> r❡t✉r♥ ♥ ✯ ❢❛❝t✭♥✲✶✮
> ❡♥❞
> ❡♥❞
> ♣r✐♥t✭✧❡♥t❡r ❛ ♥✉♠❜❡r✿✧✮
> ❛ ❂ ✐♦✳r❡❛❞✭✧✯♥✧✮
> ✲✲ r❡❛❞s ❛ ♥✉♠❜❡r
> ♣r✐♥t✭❢❛❝t✭❛✮✮
>
-- defines a factorial function
function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end
print("enter a number:")
a = io.read("*n")
-- reads a number
print(fact(a))