Ruby 2.7 introduces numbered parameters as default block parameters

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 #parameters https://rubyonrails.ba/single/ruby-2-7-introduces-numbered-parameters-as-default-block-parameters

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles