Methods & Functions in Ruby

April 3, 2023

Track your progress

Sign in to track your progress and access subscription-only lessons.

Log In

Your Teacher

Collin Jilbert

Ruby on Rails Developer | Lover of Music | Skateboarder | Proud Papa | Co-editor @therubyradar | Launched @fleur_de_ruby

About This Episode

A method or function is a way to define a group of code that can be used repeatedly. We'll learn how to define methods in our Ruby code and then use them multiple times.

Notes

What's the difference between a method and function? A method and function are exactly the same thing in Ruby.

In other languages, a function refers to a group of code that performs a specific task and method would be a function that is associated with an object (class).

For Ruby, everything is an object so a function and method are the same thing.

Want to stay up-to-date with Ruby on Rails?

Join 84,256+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.