RosettaCodeData/Task/Factorial/AppleScript/factorial-2.applescript

11 lines
169 B
AppleScript
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
-- factorial :: Int -> Int
2013-04-10 21:29:02 -07:00
on factorial(x)
2016-12-05 22:15:40 +01:00
if x > 1 then
x * (factorial(x - 1))
else if x = 1 then
1
else
0
end if
2013-04-10 21:29:02 -07:00
end factorial