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 trialZulèma van Gom
3,493 PointsWhat do you guys mean w/ "nicely formatted string"? I can't seem to find my mistake and really would like to move on.
I've been looking at my screen for 20 minutes now and I can't seem to find it. Total newby here, so my apologies.
def mod(a, b)
puts "The remainder of #{a} divided by #{b} is c."
return a % b
end
puts mod(10, 5)
2 Answers
Corina Meyer
9,990 Pointsi think it's the 'c' in the string. you may have to replace it with instead of returning the mod value
jacobproffer
24,604 PointsCorina is correct. You're supposed to use string interpolation on c. In this case, you can define a variable named c and assign it the remainder of dividing a by b. You'll also want to return the string instead of printing it.
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}."
Though I'm sure there probably is a cleaner way to write this.