Mod= Operator

Divides the value of a variable by the value of an expression, then changes the variable to the remainder.

Syntax

variable Mod= expression

Parts

variable
A numeric variable or property.
expression
A numeric expression.

Instructions

The two statements that follow operate the same.

variable Mod= expression
variable = variable Mod expression

The element on the left side of Mod= can be a scalar variable, a property, or an element of an array. If it is a property, then it cannot have the modifier @ReadOnly.

Mod= divides the variable or property on its left side by the value on its right side to get a quotient and a remainder. Then it changes the variable or property on its left side to the remainder.

Mod does some of the same operations as Mod=. Thus, the sign of the variable or property (positive or negative) does not change. This is also where Mod= is different from Rem=. Rem= takes its sign from the expression.

Data types

TODO

Division by zero

TODO

Examples

x = 42
x Mod= 10
y = 24
y Mod= -10
After execution
variablevalue
x2
y-4

See also