Ruby Inline Array Sum using reduce
> [1, 2, 3].reduce(:+)
=> 6
same for mult.:
> [1, 2, 3, 4].reduce(:*)
=> 24
Written by DeTeam
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#