14 lines
160 B
Text
14 lines
160 B
Text
|
|
/* define a recursive function */
|
||
|
|
let
|
||
|
|
|
||
|
|
/* calculate n! */
|
||
|
|
function nfactor(n: int): int =
|
||
|
|
if n = 0
|
||
|
|
then 1
|
||
|
|
else n * nfactor(n-1)
|
||
|
|
|
||
|
|
in
|
||
|
|
nfactor(10)
|
||
|
|
end
|
||
|
|
|