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 trialRaymond Rowe
6,174 PointsWhat's wrong?
It says make sure you return a nicely formatted sentence
def mod(a, b)
c = a % b
return puts "The remainder of #{a} divided by #{b} is #{c}"
end
Kourosh Raeen
23,733 PointsHi xela888 - There's really no need for an extra variable to hold the string. It's much cleaner to just return the string. In fact, we could also get rid of c as well:
return "The remainder of #{a} divided by #{b} is #{a%b}."
1 Answer
Kourosh Raeen
23,733 PointsYou have both return and puts. It should be just a return statement. Also you need a period at the end of the string:
def mod(a, b)
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}."
end
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsYou should do this: