Method Definition

Define our method in Ruby.

We'll cover the following

Stand-alone methods

So far, we’ve seen methods that are defined on objects and can be called on objects. That is, we’ve seen the downcase method that’s defined on every string.

However, Ruby also allows for methods that aren’t defined on any of these objects. They’re sort of stand-alone methods.

For example, we can try this out:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy