본문 바로가기

Ruby & Rails

[Ruby] Array Sum

(1..10).to_a.inject(:+)
a=[1,2,3,4]
a.inject(:+)
view raw s.rb hosted with ❤ by GitHub