Testing for odd/even number
|
![]() |
|
Summary |
Script example testing if the last page in the document is odd or even. |
It can also be necessary to check whether or not a number is odd or even. Because numeric variables are always whole numbers, dividing the number you want to test by two, and then multiplying it by two, will produce different results according to whether the number was odd or even. In the example below we find out if the last page of a document is even or odd: |
|
|
|
|
|
|
|
Document created on 08-Feb-2003 (revision 1)