Elegant ruby syntax to return the greater of two objects

Posted by doctororange on Stack Overflow See other posts from Stack Overflow or by doctororange
Published on 2010-03-13T15:34:11Z Indexed on 2010/03/13 15:35 UTC
Read the original article Hit count: 210

Filed under:
|
|

Of course there are a thousand ways to get this done, but is the simplest (or most elegant) way to achieve this?

[4,8].max

That's actually not too shabby, but what would you do?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about comparison