Created
June 25, 2015 20:58
-
-
Save ExReanimator/0d6733be7a2cc417866b to your computer and use it in GitHub Desktop.
My solution for Fibonacci task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fibonacci = -> (i, x = 0, y = x + 1) do | |
if i > 0 | |
puts x | |
fibonacci.call(i-1, y, x + y) | |
end | |
end | |
# calculate 10 times | |
fibonacci.call(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment