% Operator (Visual FoxPro)
Returns the remainder (modulus) obtained by dividing one numeric expression into another.
nDividend % nDivisor
Parameters
nDividend
Specifies the dividend (numeric expression being divided). The number of decimal places in nDividend determines the number of decimal places in the result.nDivisor
Specifies the divisor (the numeric expression dividing the dividend nDividend). A positive number is returned if nDivisor is positive; a negative number if nDivisor is negative. nDivisor cannot be zero.
Remarks
The modulus operator (%) and MOD( ) return identical results.
The modulus operator (%) is an arithmetic operator. Other arithmetic operators are: + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation). When these operators are combined in a numeric expression, % has the same precedence as * and /.
For a further discussion of operators and their order of precedence, see the Operators (Visual FoxPro) topic.
Example
? 36 % 10 && Displays 6
? (4*9) % (90/9) && Displays 6
? 25.250 % 5.0 && Displays 0.250
? IIF(YEAR(DATE( )) % 4 = 0, 'Summer Olympics this year';
, 'No Summer Olympics this year')