Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Basics Ruby Syntax Method Return Values

def three(number) number = 3 end puts ("3") def five(number) number = 5 end puts ("5")

The question challenge states that "Neither method should take any arguments." But after I run my code (of which I changed formats numerous times...of which I tested and was able to retain return values of 3 and 5, I receive an error message that states the "wrong number of arguments (received 0. expected 1)." So I'm just a little stuck and need a nudge forward.

methods.rb
def three(number)
  number = 3
  end

puts ("3")

def five(number)
  number = 5
  end

puts ("5")

1 Answer

Steven Parker
Steven Parker
229,732 Points

You're pretty close, but they really mean it when they say "Neither method should take any arguments."

When they test your code, they call the functions with no arguments, but since your code is expecting an argument you see the error message about "received 0. expected 1".

Just remove the parameters from the "def" lines and you should pass. And you also won't need the "puts" statements.