# I cannot understand these operators

## Recommended Posts

Hi guyspeace upon ucan u explain those operations for me??% Modulus (division remainder)++ Increment-- Decrement thanks

##### Share on other sites

Hi guyspeace upon ucan u explain those operations for me??% Modulus (division remainder)++ Increment-- Decrement thanks
`i = 3;i++;`

then i would equal 4.Decrement - Subtracts 1

`i = 3;i--;`

i would equal 2.i++ is the same as i = i+1;i-- is the same as i = i-1;

##### Share on other sites

% Any division operation can also be thought of as a fraction. Assuming integers for both the numerator and denominator, if you completely reduce the fraction (extracting the largest whole number value possible) there will or won't be a fractional portion less than zero that is "left over." If nothing is left over, % returns 0 or false. If a fractional part remains, % returns the numerator. This is especially useful in loops where you want to test if the iterating variable is a whole-number multiple or denominator of some value.Example: for i = 1 to 100. i % 10 returns false if i equals 10, 20, 30 etc.Example: for i = 1 to 100. i % 2 returns false if i is an even number, true if it's an odd numberFirefoxRocks has you covered on the others.

##### Share on other sites

Example: for i = 1 to 100. i % 10 returns false if i equals 10, 20, 30 etc.Example: for i = 1 to 100. i % 2 returns false if i is an even number, true if it's an odd number
Maisara, keep in mind that 0 is evaluated as false and non-0 is evaluated as true.39 / 10 = 3 + (9 / 10)39 % 10 = 9