From: Benoit Daloze Date: 2010-09-30T17:58:32+09:00 Subject: Re: The beauty of Ruby through examples On 30 September 2010 10:32, botp wrote: > On Thu, Sep 30, 2010 at 3:35 PM, F. Senault wrote: >> def factorial(n) >>  (1..n).inject(1, :*) >> end >> (I don't like much the second one, it's a bit less legible.) > > lose the 1. > > -botp Except if you want factorial of 0 to be right. While showing a cool example, I would go to: class Integer def ! (1..self).inject 1, :* end end 0.! # => 1