I have three variables all of which can be nil:
to
cc
bcc
How can I assign X to any one of the to/cc/bcc given that any one of them can be nil (but not all three)? It seems ugly to do
if to.nil? and cc.nil?
X = bcc
elsif ...
You can’t do
X = to or cc or bcc
either.
Yo can do this:
Or this:
||has higher precedence than=,or— lower, so first example doesn’t work without parentheses, X is just unconditionally assigned to first variable.