Ruby Ruby Basics Ruby Syntax Method Return Values

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

The program isn't recognizing my arguments.

The program isn't recognizing my arguments.

methods.rb
def three(first, second)
    first- second
end

def five( first, second)
      first+second
end

 three(8,5)
  five(2,3)

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 144,350 Points

Hi MaryAnn,

First, I've deleted the duplicate question you asked just prior to this one. Please refrain from multiple postings for the same question in the Community.

Next, the task does not ask for any parameters, so that is why you are getting an error. Instructions for tasks are very specific and need to be followed exactly. So, first, you need to remove the parameters you have for the function and just have a function with no parameters. Next, the instruction ask to return a specific value, but you seem to be doing a calculation. Finally, the instructions do not say to call the function, so you'll need to remove the function calls you have.
Other than that, your structure looks good, just fix those up and everything will pass. :thumbsup:

Have a look at the example below to see what I mean by the explanations above:

def MyFunction() #no parameters
  return 7 #returning a specific value
end

Give it another go. I'm sure you'll get it now. :) :dizzy: