Peter Szinek wrote:
> The ternary operator ? : evaluates to a value, so it expects values (or
> expressions evaluating to values, but not statements as in your example)
> after ? and : . You would also not write
> 
> x = return 5
> 
> because during an assignment, Ruby expects a value on the right side of
> the equation mark.

The ternary expression don't require value/experession but the 
assignment does so the problem is precedence rather than value 
requirement.  A code like this will work becouse parentheses solves the 
problem:

def bla(x)
  x == 5 ? (return true) : (return false)
end


but this won't becouse of the assignment that requires a 
value/expression:

x = (x == 5) ? (return true) : (return false)

cheers
MoisesMachado
-- 
Posted via http://www.ruby-forum.com/.