Created
March 25, 2016 02:24
-
-
Save joeljackson/6a66839c86cfc35aad95 to your computer and use it in GitHub Desktop.
Simple fib in ruby
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(num) | |
| return 0 if num == 0 | |
| return 1 if num == 1 | |
| return fib(num - 1) + fib(num - 2) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment