V
Valentino Lun
Dear all
I have a dummy question.
[1,2,3,4,5].inject { |sum,n| sum+n }
The inject method in this case is to calculate the sum of array.
I searched the RDoc. Why the inject method is belongs to Enumerable
Class, but not Array Class?
Many thanks
Valentino
I have a dummy question.
[1,2,3,4,5].inject { |sum,n| sum+n }
The inject method in this case is to calculate the sum of array.
I searched the RDoc. Why the inject method is belongs to Enumerable
Class, but not Array Class?
Many thanks
Valentino