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 trialAMIRALI PUNJANI
2,032 Points"Make sure you return a nicely formatted string" is the error I'm receiving.
I created the value of 'c' and typed the text as instructed, and yet I'm receiving the error.
def mod(a, b)
#write your code here
c=a% b
puts "The remainder of #{a} divided by #{b} is #{c}"
end
mod(3, 2)
3 Answers
Jesse James
6,079 PointsThere are actually two problems here causing this not to pass through:
The challenge is asking you to return the string but you're using put. Change that to return :)
You're missing the period (.) at the end of the sentence which it seems to require as well.
AMIRALI PUNJANI
2,032 PointsGot it, Thanks for the help.
Wade Christensen
Treehouse TeacherI just wanted to add that you can also do the math right in the string. Ruby will interpret it properly. For example, you could write:
def mod(a, b)
return "The remainder of #{a} divided by #{b} is #{a % b}."
end
Nicholas Kim
3,588 PointsNicholas Kim
3,588 Pointsperiod !!!!!!!! That was so..