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

Code Challenge: Methods Arguments 1 & Methods Return 2

Create a method called "hello" that takes one argument. Create a method called "mod" that take two arguments

I understand writing out the arguments in both challenges what I cannot seem to wrap my mind around is the name method called "hello" followed by a method called "mod". A thorough explanation would be helpful.

Should I

def method_name <--name as hello or class def hello/mod etc..

3 Answers

Binary Soul
Binary Soul
4,592 Points

here comes some spoilers, if you want to try around yourself, dont read further from here:

def hello(something)
  #i am a method with one argument.
end

def mod(a, b)
  # i am a method, that take two arguments, if you call me, i  divide both arguments,
  # then i return you the reminder out of that devision
  return a % b
end

you should view this tutorial series here. it provides you much more knowledge then the quicky one.

I was going by track courses, will look into it further when I come around to taking Ruby courses.

I was merely wondering what method "hello" stood for ie method add, name, mod, program are known terms of methods and I still don't understand where method hello comes from. I skipped this test passed all other code challenges to come back to this code challenge and was stuck for hours wondering what method "hello" mean.

Thanks for writing out the argument to the code challenge, though.

JENNIFER CHAKNIS
JENNIFER CHAKNIS
1,992 Points

I can't get passed this either.... is it def add(hello) or def hello.... I tried different possibilities and it is all wrong :(

I had to refresh my eyes to see question is asking to define hello as

def hello etc def mod etc etc

passed the first code challenge working on the very last challenge, will have to test the output in workspace

JENNIFER CHAKNIS
JENNIFER CHAKNIS
1,992 Points

I got it to work, let me know if you still need help with it