Methods are a powerful feature for building Ruby programs, they allow you to encapsulate behavior and call the method to implement functionality into an application. This is an important lesson, as we are going to learn about methods.
Learning what a method returns is critical in any programming language, Ruby specifically has a unique way with working with returned values. In this lesson, we are going to learn what a method returns.
Though we haven't gone deep into classes in Ruby, I thought it would be good to show you the differences between class and instance methods in Ruby, since it's important to see the different behavior.
In this lesson, we are going to talk about a cool module in Ruby called a Proc. At the highest level, procs are methods that can be stored inside variables.
Similar to Procs, Lambdas allow you to store functions inside a variable and call the method from other methods. In this lesson, we are going to go over Lambdas and how to integrate them into a Ruby program.
Now that we've seen procs and lambdas, we are going to see their differences in this lesson. There are two key differences, other than the syntax. But, they are so tiny that you may never even notice them while programming. Still, it's good to know.
This guide examines the various ways to pass arguments to methods in Ruby programs, including: the argument syntax, named arguments, and default arguments.
This guide explains how to use the splat and optional argument types with Ruby methods to give flexible interfaces to programs
devCamp does not support ancient browsers.
Install a modern version for best experience.