lang • mod

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
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

See also