Fibonacci numbers in Boo
Example for versions
boo 0.8.2
This example uses iterative definition of Fibonacci numbers. The array a
is declared to have 16 elements right away, and the elements are calculated later.
a = array(int, 16)
a[0] = a[1] = 1
for i in range(2,16):
a[i] = a[i-1] + a[i-2]
s=""
for i in range(16):
s = s + a[i] + ", "
print(s + "...")
Comments
]]>blog comments powered by Disqus
]]>