Just curious about it.
If you open the IRB and type _
, you'll get nil
as response:
irb(main):001:0> _
=> nil
And you can modify its value:
irb(main):002:0> _ = 'some value'
irb(main):003:0> _
=> "some value"
But if you create a new variable with _
, its value is modified:
irb(main):004:0> foo_bar = 'other value'
irb(main):005:0> _
=> "other value"
Why? Is this a design decision?
a = _
. I often useirb
as a handy calculator, so you can easily chain things:_ / 1e6
for example. – Solleret1_000_000
) or an ignored parameterobject.each {|_, v| ...}
– Maniple