One thing I love about Ruby is that you can express things in the shortest way possible.
I know that one can do, when assigning
x ||= a
# instead of
x = a unless x
# which is
x = x || a
Is there an analog form for return
?
# instead of
return x if x
I'm trying to "say" x
only once. This question asks about just returning (nothing), but I don't see how to do it when returning something other than void.
return x if x
with simplyx
? – Karlotta