Re:Using “and” and “or” in Ruby
by anthonyb on Monday August 02, 2010 @08:28PM
(#1569639)
In Python, the side effects were considered so nasty that they finally added ternary operators in 2.6. The syntax goes like:
which is at least more readable than the C/PHP/Ruby equivalent.
[ Parent
| on HN ]
Re:Using “and” and “or” in Ruby
by steveklabnik on Monday August 02, 2010 @10:42PM
(#1569910)
You can do
x = if foo then 'foo' else 'bar' end
in Ruby, if you'd like.