RosettaCodeData/Task/Factorial/Slate/factorial-1.slate
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

8 lines
212 B
Text

n@(Integer traits) factorial
"The standard recursive definition."
[
n isNegative ifTrue: [error: 'Negative inputs to factorial are invalid.'].
n <= 1
ifTrue: [1]
ifFalse: [n * ((n - 1) factorial)]
].