Automation Engine Script Guide > Ordered by Function > Arithmetics > MOD

MOD

Script Function: It returns the remainder of a division.

Syntax

MOD(Operand1, Operand2)

Syntax

Description/Format

Operand1

The first expression.
Format: script literal, script variable or number specified without quotation marks.

Operand2

The second expression.
Format: script literal, script variable or number specified without quotation marks.


Return code

Remainder of the division

Comments

This script function returns the remainder of the division of Operand1 by Operand2.

Operand1 and Operand2 must be integers that are within the allowed value ranges of the data types "unsigned" and "signed". Floating point numbers are not supported. The result is always a positive or negative integer. 

Operand2 must not be zero.

Examples

In the following example, this function returns the result "1".

:SET &rest# = MOD(10,3)

The result of the second example is "10".

:SET &rest# = MOD(10,44)

 

See also:

Script element Description

ADD

Performs an addition.
SUB Performs a subtraction.
MULT Performs a multiplication.
DIV Performs a division.
RANDOM Generates random numbers.

Script Elements - Arithmetics

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by function