Answers for "how does .inject work in ruby"

0

What does inject in ruby do

[3, 6, 10, 13].inject(:+) => (((3 + 6) + 10) + 13) => 32
Posted by: Guest on July-10-2020
0

What does inject in ruby do

[3, 6, 10].inject {|sum, number| sum + number} =>|3, 6| 3 + 6 => 9                                               =>|9, 10| 9 + 10 =>19
Posted by: Guest on July-10-2020

Browse Popular Code Answers by Language