I've been using Ruby for a while now, and I keep seeing this:
foo ||= bar
What is it?
This will assign bar
to foo
if (and only if) foo
is nil
or false
.
EDIT: or false, thanks @mopoke.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With