Full O' Features Ruby 2.7 has Numbered Arguments
The last TIL maybe wasn't that useful, but you can expect to see this new language feature in a ruby file near you very soon.
> [1, 2, 3, 4].map {_1 + 1}
[2, 3, 4, 5]
Numbered Arguments! The _1
is a reference to the variable that would usually be between the pipes {|x| + 1}
So what if it's not zero based :).
Tweet