Ruby 3 adds endless method definition

Akhil Gautam

By Akhil Gautam

on September 15, 2020

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.

1# endless method definition
2>> def raise_to_power(number, power) = number ** power
4>> raise_to_power(2, 5)
6=> 32

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

Stay up to date with our blogs. Sign up for our newsletter.

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