Created
December 25, 2009 23:55
-
-
Save atg/263787 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def fib | |
# The @ symbol denotes the arguments scope passed to the function | |
if @x == 0 | |
@result(x: 0, {}) | |
if @x == 1 | |
@result(x: 1, {}) | |
@result(x: fib(x: @x - 1, result: fib) + fib(x: @x - 2, result: fib), result: {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment