From: Robert Klemme Date: 2012-09-13T19:54:55+09:00 Subject: Re: Breaking Down the Block On Thu, Sep 13, 2012 at 5:55 AM, 7stud -- wrote: > However, with better variable names, it might be clearer what's going on > with inject: > > > class Array > def sum1 > inject(0) {|total, array_element| total += array_element} > end The assignment is totally superfluous. > def sum2 > total = 0 > > self.each do |array_element| > total += array_element > end > > total > end Here "self." is superfluous. ;-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/