mod
Description
Returns the remainder after dividing a number by a divisor. Equivalent to the modulus operator (%
).
Syntax
Like many functions in DataPrime, mod
supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
Name | Type | Required | Description |
---|---|---|---|
number | number | true | The value to divide |
divisor | number | true | The divisor used for the modulus operation |
Example
Use case: Determine if a number is even or odd
A value is even if dividing it by 2
leaves a remainder of 0
. Otherwise, it is odd.
Output
Theme
Light