Ruby Ruby Basics Ruby Syntax Method Return Values

Mika Laakso
Mika Laakso
4,222 Points

wrong number of arguments (given 0, expected 2)

What is wrong with my code? I thought these arguments would return three and five...

methods.rb
def three a, b
  return a + b

end

def five c,d
  return c-d

end

three(1, 2)
five(7, 2)

2 Answers

Manish Giri
Manish Giri
16,264 Points

The challenge you've linked to just asks to create functions that return 3 and 5 respectively.

def three
  3
end

def five
  5
end

Also, unless explicitly stated, you aren't required to call your functions.

Mika Laakso
Mika Laakso
4,222 Points

Thank you, Manish,

I tried almost the same code before but I had 3 on the same line of three and 5 five on the same line of five so it gave a syntax error. Thank you. Now I can move forward.