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!
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 trial

Wannakorn panij
1,358 PointsWhy (i % 3 == 0) why it need to == 0 I didn't get it ?
Why (i % 3 == 0) why it need to == 0 I didn't get it ?
1 Answer

Jennifer Nordell
Treehouse TeacherWell it's hard to know exactly which exercise/challenge/video you're referencing. But what they're asking is this: is the value stored in the variable i evenly divisible by 3.
Let's look at some examples.
4 divided by three results in 1 with a remainder of 1. That means 4 % 3 ==1.
5 divided by 3 results in 1 with a remainder of 2. So 5 % 3 == 2.
6 divided by 3 results in 2 with a remainder of 0. 6 % 3 == 0. Six is evenly divisible by three.
Hope this helps!
Wannakorn panij
1,358 PointsWannakorn panij
1,358 PointsThank a lot Jennifer DDDDDDDDD