|
|
|
|
|
by dlisboa
3619 days ago
|
|
Haven't tried it, but the assignment semantics is that the return of the assignment expression is always the right hand side of the operator. They probably kept that semantic. So foo, bar = ['foo', nil]
evaluates to ['foo', nil]
which is truthy.If the code was: if (foo, bar = [nil, nil])
'truthy'
else
'falsey'
end
It'd still be truthy even if no variables were "set" (they were actually set, explicitly to nil, but you get the idea) because [nil, nil] is truthy. It doesn't have anything to do with the values of the variables after the assignment, just what's on the right hand side. |
|