This is just fine:
def foo
a or b
end
This is also fine:
def foo
return a || b
end
This returns void value expression:
def foo
return a or b
end
Why? It doesn't even get executed; it fails the syntax check. What does void value expression mean?
return a or bis interpreted as(return a) or b, and so the value ofreturn ais necessary to calculate the value of(return a) or b, but sincereturnnever leaves a value in place (because it escapes from that position), it is not designed to return a valid value in the original position. And hence the whole expression is left with(some_void_value) or b, and is stuck. That is what it means.