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
171,228 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.