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 trialms onefaithlove
Courses Plus Student 2,794 PointsI have a feeling it's very obvious... pardon me! What am I doing wrong?
Which two arguments should be beside mod? How do I say a%b=c in a valid way?
def mod(a, b)
puts a % b = c
puts "The remainder of #{a} divided by #{b} is #{c}"
end
3 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Ana,
You are on the right track, but there are 3 little things:
You have an unneeded
puts
statement (that also wasn't asked for in the challenge) where you are doing the calculation. This calculation should actually be done right in the interpolated string.You are using
puts
on the interpolated string when the challenge is asking for areturn
.Challenges are very picky and very strict. So, this one is more just that. You are missing a period inside of the String Interpolation.
def mod(a, b)
return "The remainder of #{a} divided by #{b} is #{a % b}."
end
Keep Coding! :)
Kourosh Raeen
23,733 PointsThe method should return that string so try return instead of puts:
def mod(a, b)
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}."
end
ms onefaithlove
Courses Plus Student 2,794 PointsThank you both!!! This makes so much sense. Sipping (gulping) a fresh cup of coffee. Need it evidently, ha! Brilliant.