From: "Jesús Gabriel y Galán" Date: 2013-06-25T16:50:28+09:00 Subject: Re: Sum method through while loops or iteration On Tue, Jun 25, 2013 at 9:44 AM, Hans Mackowiak wrote: > "Jesús Gabriel y Galán" wrote in post > #1113505: > >> 2.- More functional styles: >> >> 2.0.0p195 :029 > a.inject(0) {|total, x| total + x} >> => 10 >> 2.0.0p195 :030 > a.inject(:+) >> => 10 >> > > there is a difference: > > [].inject(0) {|total, x| total + x} > => 0 > [].inject(:+) > => nil Good catch ! Jesus.