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 trialdavid kennedy
2,291 PointsDon't understand why this is wrong: “The remainder of #{a} divided by #{b} is #{c}.” end
def mod(a, b) puts a % b “The remainder of #{a} divided by #{b} is #{c}.” end
def mod(a, b)
c = puts a % b
“The remainder of #{a} divided by #{b} is #{c}.”
end
2 Answers
Tobias Helmrich
31,603 PointsHey there,
you're trying to save the puts statement inside of the variable c. However you want to save the remainder in the c variable so you should leave away the puts and just calculate it. I also noticed that you're not using "normal" quotes, that's also the reason why the code highlighting doesn't work correctly. Make sure to use the right quotes and it should look like this:
def mod(a, b)
c = a % b
"The remainder of #{a} divided by #{b} is #{c}."
end
I hope that helps, if you have further questions feel free to ask! :)
david kennedy
2,291 PointsGreat! thanks so much that completely makes sense.