Mod in Ordinal Extractions
In the same manner that sub-strings can be extracted from strings with the Left() function, the Mod operator can be used to extract digits from integer values:
(19984 - (19984 Mod 10))/10 = 1998
The Mod operator used like the Right() function:
19984 Mod 10 = 4
Thanks to the Mod operator, more traditional scalar operators can be used in concatenation-like operations:
1998 * 10 + 4 = 19984
Mod in Boolean Evaluations
Test for an odd number with Long lngTest against the Boolean blnTest:
blnTest = (lngTest Mod 2 = 1)
Test for an even number with Long lngTest against the Boolean blnTest:
blnTest = (lngTest Mod 2 = 0)
Test for a multiple of six with Long lngTest against the Boolean blnTest:
blnTest = (lngTest Mod 6 = 0)
IMPORTANT: Recall that Mod operations return the remainder in integer division. When the Long variable (lngTest) becomes involved in a Mod operation, it makes explicit the use of integers. Without lngTest, there is implicit rounding. For example:
(13.4 Mod 2 = 13 Mod 2) = True
and
(13.5 Mod 2 = 14 Mod 2) = True