Fibonacci numbers in Io
Example for versions
Io-2008-01-07
This example uses iterative definition of Fibonacci numbers. for
loop misses fourth parameter which sets loop step — it defaults to 1, so no need to set it explicitly.
N0 := 0;
N1 := 1;
for(i,1,16,
N2 := N1+N0;
N0 := N1;
N1 := N2;
N0 print;
", " print;
);
"..." println;
Comments
]]>blog comments powered by Disqus
]]>