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 trialYI JIANG
3,424 Pointswhat's wrong
def mod(a, b) return "The remainder of a divided by #{a%b}" end mod(a, b)
def mod(a, b)
return "The remainder of a divided by #{a%b}"
end
mod(a, b)
2 Answers
woodworth
Front End Web Development Techdegree Student 19,831 PointsYou are very close but missing some interpolation.
def mod(a, b)
return "The remainder of #{a} divided by #{b} is #{ a % b }"
end
puts mod(5, 2)
-- I used the above example to check the code since 5 % 2 = 1 and got back "The remainder of 5 divided by 2 is 1"
woodworth
Front End Web Development Techdegree Student 19,831 PointsYou are still missing #{ } on the letter a before divided.
I did this problem in my console so used puts to check to see if it worked with the two numbers knowing 5 % 2 = 1. I then got back "The remainder of 5 divided by 2 is 1"
Via Jason, it doesn't sound like you need to call the function for this exercise though so you can ignore that part of the code (but will still need to add a period to the end of the sentence).
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsI didn't check the challenge but I think there needed to be a period at the end of the output.
YI JIANG
3,424 PointsYI JIANG
3,424 Pointsdef mod(a, b) return "The remainder of a divided by #{b} is #{ a % b }" end
puts mod(5, 2)
not working why puts?
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsYou don't need to call the function. you only need to write the function definition.
As woodworth mentioned, you're still missing the interpolation for a
Also, it's not going to pass without a period at the end of the string.