# mod

The keyword mod belongs to the family of the arithmetic operators. It operates on two operands of integer type and on its derivates. The operation x mod y computes the rest that remains from an integer division of x by y.

- The result of the operation is integer;
- the operation is defined for non-zero operands only;
- the result is always non-negative, see chapter 15.1 of the standard.

Related keywords:

- rem

### mod

Example:

for (var integer j:=-3; j<=3; j:= j+1) {
var integer vl_log := (j mod 3);
log (vl_log)
}

The log will contain the following integer values: 0 1 2 0 1 2 0.

BNF definition of mod