Created
September 17, 2017 20:58
-
-
Save cameck/15110fe7fdcec9525c9eb3fc49931218 to your computer and use it in GitHub Desktop.
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
def sum(arr) | |
arr.empty? ? 0 : arr.shift + sum(arr) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment