On Mon, Sep 17, 2012 at 11:28 PM, Josh Cheek <josh.cheek / gmail.com> wrote:

> On Mon, Sep 17, 2012 at 11:03 PM, Brandon Weaver <keystonelemur / gmail.com>wrote:
>
>>
>>   array.inject(0) { |sum, i| sum+i }
>>>
>>> Cheers.
>>>
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>>
>> You could also use a shorter version of inject:
>>
>> array.inject(:+)
>>
>
> You still need to give it an initial value or it will be wrong when there
> are no elements.
>
> array.inject 0, :+
>


Granted and noted, nice catch