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 trialMarcelo Sandoval
2,055 PointsWhat is the remainder operand? That was covered yet.
That was covered yet.
2 Answers
andren
28,558 PointsThe remainder operator, also commonly known as the modulo operator in other languages is: %.
And it is used in the same way you would other operators like +,-, etc.
So "5 % 2" for example would compute the remainder of dividing 5 by 2.
Marcelo Sandoval
2,055 PointsGot it...makes sense. Thank you.
Marcelo Sandoval
2,055 PointsMarcelo Sandoval
2,055 PointsThank you. Why does 3 % 7 result in 3? Per the code challenge.
andren
28,558 Pointsandren
28,558 PointsWhen doing integer division (ignoring decimals) 3 / 7 would be 0. the difference (remainder) between 0 and 3 is 3. So 3 is the remainder of that operation.
This essentially means that any modulo operation where the first number is lower than the second will result in a remainder equal to the first number.
etc.