using inject in ruby code example
Example 1: What does inject in ruby do
[3, 6, 10].inject {|sum, number| sum + number} =>|3, 6| 3 + 6 => 9 =>|9, 10| 9 + 10 =>19
Example 2: What does inject in ruby do
[3, 6, 10, 13].inject(:+) => (((3 + 6) + 10) + 13) => 32