BigBinary Blog

We write about Ruby on Rails, React.js, React Native, remote work, open source, engineering and design.

Ruby 3 adds endless method definition

This blog is part of our Ruby 3.0 series.

Ruby 3.0 adds endless method definition. It enables us to create method definitions without the need of end keyword. It is marked as an experimental feature.

# endless method definition
>> def raise_to_power(number, power) = number ** power

>> raise_to_power(2, 5)

=> 32

The discussion around it can be found here. Check out the pull request for more details on this.

Akhil Gautam in Ruby, Ruby 3
15, 2020

You might also like

Ruby 3 is released - The list of Ruby 3 features

Ruby 3 supports transforming hash keys using a hash argument

Ruby 3 adds new method Hash#except

Ruby 3 adds Symbol#name

Subscribe to our newsletter