MOD
Remainder = Numerator AS Integer MOD Denominator AS Integer
计算两个integer数相除的余数。
该操作不等于真正的数学取模运算:
A MOD B = A - (A DIV B) * B
示例
PRINT 9 MOD 4, -9 MOD 4, 9 MOD -4, -9 MOD -4
' To test divisibility by 5
DIM N AS Integer
N = 563
IF N MOD 5 = 0 THEN
PRINT "The number " & N & " is divisible by 5"
ELSE
PRINT "The number " & N & " is not divisible by 5"
ENDIF
The number 563 is not divisible by 5
参见