Rem
Operator
Divides two numbers and returns only the remainder.
Syntax
number_1 Rem number_2
Parts
number_1
- A numeric expression.
number_2
- A numeric expression.
Instructions
The result is the remainder after number_1
is divided by number_2
.
For example, the expression 42 Rem 5
gives a result of 2.
The result has the same sign as number_2
.
Compared to Rem
, the result of the related operator Mod
gets the sign of its first number.
But it can be easy to select the correct operator for the given conditions.
The letter “M” is nearer to the number that gives the result its sign.
Data types
TODO
Division by zero
TODO
Examples
TODO
Program Example
#Debug.PrintLine "42 Rem 5 = " & 42 Rem 5
#Debug.PrintLine "-42 Rem 5 = " & -42 Rem 5
#Debug.PrintLine "42 Rem -5 = " & 42 Rem -5
#Debug.PrintLine "-42 Rem -5 = " & -42 Rem -5
42 Rem 5 = 2 -42 Rem 5 = 2 42 Rem -5 = -2 -42 Rem -5 = -2 |