Factorial in Nimrod
Example for versions
Nimrod 0.8.8
This example uses iterative factorial calculation. Note that you can’t just omit int64
in variable definition, since its type will be deduced as integer, and it will overflow on 13!.
var f: int64 = 1
for i in countup(0,16):
echo i, "! = ", f
f = f * (i + 1)
Comments
]]>blog comments powered by Disqus
]]>