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 trialKazhian Muthusami
2,484 PointsWhat is wrong with this code?
Why is this code not accepted?
def mod(a, b)
βThe remainder of #{a} divided by #{b} is #{c}.β
end
1 Answer
Greg Kaleka
39,021 PointsHi Kazhian,
There are a couple things wrong here.
- First and foremost, your method doesn't return anything at all! You need to use a return statement.
- You're using curly quotes, or "smart quotes" instead of the unstyled quotes
"
. Not sure how that happened - did you copy-paste from somewhere? -
c
is not defined.
I don't want to give you the solution, since I'm pretty sure you can figure it out from here. Let us know if you have trouble!
Cheers
-Greg
Kazhian Muthusami
2,484 PointsKazhian Muthusami
2,484 PointsHi Greg, thanks for the reply. In ruby, return statement is not required. That's why I didn't include. However, now I added. But getting below error:
Heres is the code:
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsAh - you're right. Sorry, my Ruby is a bit rusty.
Looks like you fixed item 2, but item 3 still stands - you're using c, which is not defined. Switch that to b and you should be good.