LOTUSSCRIPT LANGUAGE


Mod operator
Divides two numbers and returns the remainder.

Syntax

numExpr1 Mod numExpr2

Elements

numExpr1, numExpr2


Return value

The result is of data type Integer, Long, or Variant of type Integer or Long.

If either or both operands are NULL expressions, the result is a NULL.

Usage

The remainder operator divides numExpr1 by numExpr2 and returns the remainder.

The operands are rounded to Integer expressions before the division takes place.

Language cross-reference

@Modulo function in formula language

Example

This example contrasts Modulo division with ordinary division. Mod returns the remainder, while ordinary division returns the dividend.

Print 12 Mod 8               ' Prints 4
Print 12 / 8                 ' Prints 1.5

See Also