Error getting tags :
error 404Error getting tags :
error 404 mod | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
mod
Basics
Expander triangle
Type
Operator
Syntax
number mod divisor
See Also
Introduced
1.0
Changed
1.1
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Evaluates to the remainder left over when one number is divided by another.
Examples

23 mod 5 -- evaluates to 3 (23 div 5 is 4, with 3 left over)
12 mod 4 -- evaluates to zero
23 mod -5 -- evaluates to 3

Additional Comments
Expander triangle

Use the mod operator to perform modulus arithmetic.

Parameters:

The number is a number, or an expression that evaluates to a number, or an array containing only numbers.

The divisor is any non-zero number. If the number is an array, the divisor is either a non-zero number or an array containing only non-zero numbers.

Comments:

If the number to be divided is an array, each of the array elements must be a number. If an array is divided by a number, each element is divided by the number. If an array is divided by an array, both arrays must have the same number of elements and the same dimension, and each element in one array is divided by the corresponding element of the other array.

If an element of an array is empty, the mod operator treats its contents as zero.

If number can be divided evenly into divisor, the expression number mod divisor is zero.

Attempting to divide by zero causes an execution error.

Note: Using non-integer number and divisor usually produces sensible results. However, mathematically, modulus is generally defined as a function over the integers, and the results using non-integers may not consistently be what you expect.

Changes to Revolution:

The option to divide arrays was introduced in version 1.1. In previous versions, only single numbers could be used with the mod operator.

User Comments
Expander triangle