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 trialsarah strange
556 Pointsthe code is right but the system will not let me continue, keeps saying make sure the string is properly formatted
the code is right not sure why it won't let me proceed
def mod(a, b)
c = a % b
puts "The remainder of #{a} divided by #{b} is #{c}."
return c
end
mod(18, 5)
1 Answer
Alexander Davison
65,469 PointsYou did a great job! Code challenges are picky. This should work 100% fine if you run the code in irb or something, but the code challenge expects you to return the string, making puts useless here. Also, the code challenge automatically runs the function so you don't need the
mod(18, 5)
line of code. Try doing that! :)
Here's the complete code:
def mod(a, b)
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}."
end
Good luck! ~Alex
sarah strange
556 Pointssarah strange
556 Pointscool thank you! :)
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsCan you give me a best answer please so that this question won't be in the "Unanswered Questions" section of the Community? Thank you very much! ~Alex