Skip to content

Instantly share code, notes, and snippets.

@cameck
Created September 17, 2017 20:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cameck/15110fe7fdcec9525c9eb3fc49931218 to your computer and use it in GitHub Desktop.
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