...

>

Usage

Usage

This lesson will brief you on how to use methods in Ruby after defining them.

Once defined we can use our method

As programmers we usually say that we “call” a method. This means we ask Ruby to execute the code that the method body has, with some given arguments (input), if any.

Here’s ...

Ruby
def add_two(number)
number + 2
end
puts add_two(3)

Explanation

Let’s inspect ...

Create a free account to access the full course.

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