Mod Operator

Divides two integers and returns the integer remainder.

Syntax

result = number1 Mod number2

Arguments

  • Result
    Any numeric variable.

  • number1
    Any numeric expression.

  • number2
    Any numeric expression.

Remarks

If number1 or number2 are floating point numbers, they are first rounded to integers.

The Mod (modulus) operator divides number1 by number2 and returns the integer remainder.

For example, in the following expression, A equals 5.

A = 19 Mod 7

If any expression is Null, result is also Null. Any expression that is Empty is treated as 0.

Requirements

Version 1

Change History

Date

History

Reason

September 2009

Modified example and explanation of example.

Customer feedback.

See Also

Arithmetic Operators
Operator Precedence (VBScript)
Operator Summary (VBScript)