Factorial in Nimrod
Example for versions
Nimrod 0.8.8
This example uses recursive factorial definition.
proc factorial(n: int): int64 =
if n == 0:
result = 1
else:
result = n * factorial(n - 1)
for i in countup(0,16):
echo i, "! = ", factorial(i)
Comments
]]>blog comments powered by Disqus
]]>