Scripting > Expressions > Operators > Arithmetic operators > Mod operator
 
Mod operator
 
Double
Long
Text
Categorical
Date
Double
Modulus Long
Modulus Long
Modulus1 Long
Not applicable
Not applicable
Long
Modulus Long
Modulus Long
Modulus1 Long
Not applicable
Not applicable
Text
Modulus1 Long
Modulus1 Long
Not applicable
Not applicable
Not applicable
Categorical
Not applicable
Not applicable
Not applicable
Not applicable
Not applicable
Date
Not applicable
Not applicable
Not applicable
Not applicable
Not applicable
Example: Numeric variables
visits mod visits12
The modulus operator divides one numeric value by another and returns the remainder as result. This example uses the visits and visits12 numeric (Long) variables again. If visits has the value 8, and visits12 has the value 3, the return value is 2.
Notes
1 Only if conversion from text to numeric is possible.
2 Operation occurs on the date's double value representation. If the operation involves an invalid date, '####' is returned.
3 Only if conversion from text to long or categorical is possible.
4 Only if conversion from text to date is possible.
5 If the text can be converted to a long without loss of precision, the result is a long.
See also
Categorical set logic
Arithmetic operators