Modulo
ActionStep Reference » Programming » Number Operation » Basic » Modulo
The ActionStep Modulo divides two numbers and stores the remainder in Result of the Result List. The following number types are allowed: Floating Point, Signed Number, and Unsigned Number.
- Open the Programming node in the Workspace Explorer.
- Open the Number Operation node.
- In the Basic node, select the Modulo ActionStep.
Parameters:
The ActionStep has the following input parameters:
name |
Description
|
---|---|
Number Type
|
Specifies the data type to be used for the numbers to be divided and its result.
Allowed Context Scope [Fixed] Allowed Values [Floating Point, Signed Number, Unsigned Number] |
Dividend
|
The number to be divided.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Denominator
|
The number that divides the dividend.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Results:
The ActionStep returns the following results:
name
|
description
|
---|---|
Result |
Contains the remainder after dividing the two numbers.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter] |
The number type set in the ActionStep Modulo determines the data type of its Result even if the variables and/or parameters that were set for the dividend and denominator are of different data types. |
An exception error occurs when a number (signed or unsigned) is divided by zero.
An infinite loop will occur when a floating point is divided by zero. |
To prevent an exception or an infinite loop, the denominator must be a non-zero digit. |
Example 1 (Convert Work in Minutes to Hours and Minutes):
This example divides the contents of the two local variables, Work In Minutes and Conversion Factor. Both variables use the data type, Number. The quotient and remainder after dividing the two numbers are then output under Write Text.
See other Basic operations:
Add
Subtract
Multiplicate
Divide
Power
Root
Increment
Decrement
Random