How do I determine if a number is even or odd?
An even number is any number that can be divided by 2 with no remainder. ColdFusion provides a function, mod, that returns the remainder of a division operation. To determine if a number is even, simply see if the value, modded by 2, returns 0:
If the remainder is 1, then the number is odd.
This question was written by Raymond Camden.
It was last updated on February 3, 2006 at 8:01:44 AM EST.