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 (Retired) Ruby Methods Method Arguments: Part 1

Takuji Sakashita
Takuji Sakashita
3,372 Points

Create a method called hello that takes one argument.

what should i do to answer this question?

method.rb
def hello(a,b)
  puts a+b
end
Brian Pedigo
Brian Pedigo
26,783 Points

It looks like you put more effort into answering the question than is required. To pass this challenge just create a method that takes one argument. Notice the question doesn't ask for any internal logic in the method! Therefore, to pass this you could simply put.

def hello(arg)
end

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hi Takuji,

Your code is correct syntactically, but it is not what the challenge asked for. The challenge wants you only to

Create a method called hello that takes one argument.

But, in your code, the method has 2 arguments instead of just one as per the instructions.

Second, the challenge just want a method, it did not ask for a puts statement or anything else to be inside the body of the method.

If you fix those two things up, the code will pass. :)

Keep Coding! :dizzy: