Closed
Description
Input:
result = if false && val = 1
"A"
else
"B"
end
puts result
(prints "B" when run)
stree format
output:
result = (false && val = 1 ? "A" : "B")
puts result
This prints false
when run.
It seems that the precedence of the =
operator is not being considered correctly. It's also curious that the entire ternary expression has been wrapped in parenthesis - they don't seem to have any effect.
The 'correct' output would be for the parenthesis to wrap only the condition part of the ternary:
result = (false && val = 1) ? "A" : "B"
Metadata
Metadata
Assignees
Labels
No labels