The % is actually modular arithmetic, which is similar to but not quite a remainder. The % operation gives you the number left over after you subtract the largest multiple of the modulus. So lets say you do 64 % 10: the first step (behind the scenes) is to find out how many times 10 goes into 64, which is 6. It then subtracts that modulus (10) multiplied by the number (6x10 - 60), to give you the remainder 4. If you do 4%10, the same thing happens. First calculate how many times 10 goes into 4, which is 0. You then subtract that result (0) multiplied by the % (10) which is (0 * 10) also zero. So 4 - 0 gives a result of 4. So when using %, if the number on left is smaller than the number on the right, you always get back the number on the left (not 0). Things get even weirder if the number on the left is negative, so we'll ignore that. Note that your are performing modular arithmetic if, say, it is now 7 AM, and you have an appointment in 40 hours. What time of day will that appointment offur on. That is (40+7) % 24: first see how many time 24 goes into 47: we ow know the appointment is 1 day later. Now 47 % 24 gives 23, so the appointment is 23 hours into the day. If we want to convert that into AM/PM, so lets do a quick modular calculation (23 % 12) to learn that is at 11PM. A weird time for an appointment! But we now now the appointment is 11PM tomorrow.