RosettaCodeData/Task/Factorial/FunL/factorial-1.funl

11 lines
145 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
def factorial( n ) =
if n < 0
error( 'factorial: n should be non-negative' )
else
res = 1
for i <- 2..n
res *= i
res