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 trialSteven Islas
691 PointsRuby Basics: Create a method called "multiply" that takes two arguments.
I cannot seem to get my code correct. I typed in the following:
def multiply(a, b)
end
3 Answers
Steven Islas
691 PointsLayer 8 issue. I was suppose to leave the original code from the prior task. So, the working code will look like:
def subtract (a, b)
end
def multiply (a, b)
end
William Li
Courses Plus Student 26,868 PointsSince you didn't provide the link to the original code challenge, I have no idea what exactly the challenge is asking for. My best guess is that your method is missing a method body, because it's a multiplication, you need to return the product of the 2 numbers.
def multiply(a, b)
return a * b
end
Try and see if it works.
Steven Islas
691 PointsThanks William Li. I updated my original post and tried your code. It still did not work. Anything else I can try?
Ferhat Aydin
2,153 Pointshereby the answer
def subtract(a, b)
puts a - b
end
subtract( 9, 4)
def multiply(b, c)
puts b * c
end
multiply(4, 6)