MOD

Remainder = Numerator AS Integer MOD Denominator AS Integer

Computes the remainder of the division of two integer numbers.

This operator does not evaluate the true mathematic modulo:

A MOD B = A - (A DIV B) * B

Examples

PRINT 9 MOD 4;; -9 MOD 4;; 9 MOD -4;; -9 MOD -4
1 -1 1 -1

' Test divisibility by 5

DIM N AS Integer
= 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

See also