[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: ruby way to say this?

Gavin Kistner

10/17/2006 8:04:00 PM

On Oct 17, 2:00 pm, Simon Kröger <SimonKroe...@gmx.de> wrote:
> Well, most of the time just ask ruby to do what you want:
>
> oneThing.nonzero? || otherThing
>
> --------------------------------------------------------------------------
> num.nonzero? => num or nil
>
> Returns num if num is not zero, nil otherwise. This behavior is useful when
> chaining comparisons:

Bah! You have to come up with the easy answer and spoil all of our fun,
don't you?