incag neato wrote in post #1075712:
> Can someone please explain in plain english how this block treats the
> given variables (and values in the array)? I am struggling to understand
> the relationship of 't' and 'n' with the array.
>
> class Array
>   def sum
>     inject(0) {|t,n| t + n}
>   end
> end
> puts [1,2,3].sum
>
> Is 't' effectively labeled as '0' (zero), given the assignment on the
> inject method?
> What "is" 't' exactly?


Just forget inject() even exists.  It's really quite a pathetic method.

-- 
Posted via http://www.ruby-forum.com/.