lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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))