Ruby 2.7 introduces numbered parameters as default block parameters
06-Mar-2020 1439
Ruby 2.7 introduces a new way to access block parameters. Ruby 2.7 onwards, if block parameters are obvious and we wish to not use absurd names like n or i etc, we can use numbered parameters which are available inside a block by default.We can use _1 for first parameter, _2 for second parameter and so on.Here’s how Ruby 2.7 provides numbered parameters inside a block. Below shown are the examples from above, only this time using numbered parameters.
Ruby 2.7 introduces numbered parameters as default block parameters #ruby #rubydeveloper #rubyonrails #introduces #numbered #parameters #default #block #parameters #parameters https://rubyonrails.ba/link/ruby-2-7-introduces-numbered-parameters-as-default-block-parameters