Ruby Ruby Basics Ruby Syntax Method Return Values

Aparna Balasubramanian
Aparna Balasubramanian
1,488 Points

Define a method named three that always returns the number 3. Also define a method named five that always returns the nu

Define a method named three that always returns the number 3. Also define a method named five that always returns the number 5. Neither method should take any arguments. (We know, these methods aren't especially useful. We just want to see if you know how to make a method return a particular value!)

2 Answers

Brandon Evans
Brandon Evans
8,154 Points

Hi Aparna!

Did you attempt to solve this yourself? In the future, please provide your code so that we can take a look and see how we can help! Assuming you did try and got stuck, here is what the solution should look like:

def three()
  return 3
end

def five()
  return 5
end
Zachary Scott
Zachary Scott
1,637 Points

Spoiler Alert

def three()
  3
end

def five()
  5
end