**How tell if a number is even or odd:**

Function IsEven(Number As Integer)
As Boolean

If Number Mod 2 =
0 Then

IsEven = True 'return
value

Else

IsEven =
False 'return value

End If

End
Function

So, how and why does Mod know if a number is even or odd? Mod reveals the remainder after division of an integer. Any integer dividing evenly by 2 will have a remainder of 0. Odd numbers will have a remainder...

Mod = __remainder__ of an integer division (**i.e.**
9 Mod 2 = 1)

+ |
addition (i.e.
2 + 3 = 5) |

- |
subtraction (i.e.
7 - 3 = 4) |

* |
multiplication (i.e.
3 * 7 = 21) |

/ |
division (remember that
the result may not be of the Integer type -
i.e. 9 / 2 =
4.5) |

\ |
integer division (always
returns an integer result - i.e.
9 \ 2 = 4) |

Mod |
remainder of an integer
division (i.e.
9 Mod 2 = 1) |

^ |
power (i.e.
2 ^ 3 = 8) |