Fibonacci sequence: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Rearranged iterative +/- to iterative section)
Line 979: Line 979:
===Recursive===
===Recursive===


<lang arturo>fib: @(x){
<lang arturo>fib: $[x][
if x<2 { 1 }{
if? x<2 [1]
[fib x-1] + [fib x-2]
else [(fib x-1) + (fib x-2)]
]
}
}</lang>


loop 1..25 [x][
===Recursive with Memoization===
print ["Fibonacci of" x "=" fib x]

]</lang>
<lang arturo>Fib $(memoize [x]{
if x<2 { 1 }{
$(Fib x-1) + $(Fib x-2)
}
})</lang>


=={{header|AsciiDots}}==
=={{header|AsciiDots}}==