First page Back Continue Last page Overview Graphics
Like many of its peers, Ruby supports the ternary operator, simplifying
if array.empty?
foo = 'bar'
else
foo = 'baz'
end
to
foo = array.empty? ? 'bar' : 'baz'
Whether it's more readable is arguable