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 trialWouter Vermeersch
6,913 PointsUnable to get this right
This code just seams right but I can4t make it working , please help
def mod(a, b)
c = a%b
return βThe remainder of #{a} divided by #{b} is #{c}.β
end
puts mod(2, 3)
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! You're doing just fine! My guess is that you may have done some of this code in a text editor that is "smart" and changing your quotation marks for you. Take a close look at the quotation marks in your code. They are the slanted version.
Your code:
return βThe remainder of #{a} divided by #{b} is #{c}.β
Correct code:
return "The remainder of #{a} divided by #{b} is #{c}."
Also, your final puts
statement is not needed as the challenge will call the function for you and pass in the values they choose.
Hope this helps!
Wouter Vermeersch
6,913 PointsTY Jennifer! :) stupid to have different double quotes though. Like many lazy programmers out there copy paste is a regular habit :)
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHiya,
You're right. I've found if you copy the string from the question (I know, I'm lazy!) it gives you the stylised ones. I've head-scratched on that many times! There's a couple of the Swift and Java courses where this crops up from time-to-time too.
Steve.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherSteve Hunter It's because the quotation marks in the instructions are the stylized ones in some cases. This is one of them. However, there are occasions where people have had this happen from text they copied from their local machines. I know that Microsoft Word is especially guilty of doing this
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsWord is a nightmare for most things, I find!