Divides the value of a variable by the value of an expression, then changes the variable to the remainder.
variable Rem= expression
- A numeric variable or property.
- A numeric expression.
The two statements that follow operate the same.
variable Rem= expression variable = variable Rem expression
The element on the left side of
Rem= can be a scalar variable, a property, or an element of an array.
If it is a property, then it cannot have the modifier
Rem= 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.
Rem does some of the same operations as
Thus, the sign of the variable or property (positive or negative) becomes the sign of the expression.
This is also where
Rem= is different from
Mod= takes its sign from the variable or property.
Division by zero
x = -42 x Rem= 10