Operators: %

Modulo division (remainder) operator.

Syntax

integer‑operand%integer‑operand

Integer modulo division

The % operator divides the left integer operand by the right integer operand and returns the remainder left over. If used with two signed integer operands, the resulting data type is always int32. In all other cases, the operation results in the unsigned uint32 value. Please note, trying to perform the division with the right operand == 0 (zero) will raise a 'division by zero' runtime CPU exception. For example:

var int32 a = 2500; var int32 b = -7; var uint32 c = 1098; var uint32 d = 57; var int32 result = a % b; // result = 1 var uint32 result = c % d; // result = 15 var uint32 result = b % d; // result = 18 (overflow)