Visual Basic Wiki
Advertisement

Operator: Mod

Evaluates the remainder if n1 was divided by n2

The result is the remainder after number1 is divided by number2. For example, the expression 14 Mod 4 evaluates to 2.

It's a very simple operation like dividing : you divide 14 by 4

4 is multiplied by 3 so we have now 12

14-12 = 2 which is the remainder

You can make a table of division like we used to do in school so you'll have better results for large numbers (you must multiply until the last number before comma so you'll have the remainder)

Using

Rst = n1 Mod n2

Example

6 Mod 2 =
Advertisement