[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: alternatives to ? : contruct

Eric Mahurin

5/11/2005 8:07:00 PM

> As an alternative to:
>
> a = y == z ? b : c
>
> we can say:
>
> a = (b if y == x) || c
>
> Can anyone think of others?

Here is yet another solution (as long as b is not nil/false
when y==z):

a = y==z && b || c




Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mai...