Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Ruby Array Sum] #ruby #iterator #sum
# you can call #sum iterator on it:
numbers = [1, 2, 3, 4, 5]
# => 15
# N.B: In Ruby versions < 2.4, sum didn't exist. The idiomatic way to get the same result was with #reduce:
# => 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.