Also, in irb and rails console, _ holds the return value of previous line. So if you do something and forget to assign it to a variable, you can just write a = _.
_
a = _
Wow. I remember a blogpost (by @roidrage iirc) where using _ to discard a block variable was introduced.
Back then I just thought “nice someone used Haskell and just decided to use _ in Ruby like they did in Haskell.”
I didn’t know there was explicit support for that in MRI.
Also, in irb and rails console,
_holds the return value of previous line. So if you do something and forget to assign it to a variable, you can just writea = _.Wow. I remember a blogpost (by @roidrage iirc) where using
_to discard a block variable was introduced.Back then I just thought “nice someone used Haskell and just decided to use
_in Ruby like they did in Haskell.”I didn’t know there was explicit support for that in MRI.