fn factorial n = ( if n == 0 then return 1 local fac = 1 for i in 1 to n do ( fac *= i ) fac )