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 2

Victoria Moser
Victoria Moser
2,668 Points

Define multiply method that takes 2 arguments

I did:

def multiply (a, b) end

No idea what's wrong keep getting that it's wrong. Please help! Thanks in advance!

method.rb
def multiply (a, b)
end 

2 Answers

Allison Hanna
Allison Hanna
36,222 Points

Hi, Your setup is fine, now you just need to add the body of the function. Specifically, when the method is invoked, what should happen?

def multiply (a, b)
    a * b
end

And now if someone calls the function, for example multiply(2, 4) the output will be 8.

Victoria Moser
Victoria Moser
2,668 Points

I did that too and I still get the following :

Oops! It looks like Task 1 is no longer passing. Get Help

Allison Hanna
Allison Hanna
36,222 Points

I just went to look at the challenge. Task 1 won't pass if you've deleted the subtract function. You need to keep both in order to pass.

def subtract (a, b)
end

def multiply (a, b)
end