This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
Mod
|
Mod ( number1 ; number2 ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
number1 | Longint |
![]() |
Number to divide | |||||
number2 | Longint |
![]() |
Number to divide by | |||||
Function result | Real |
![]() |
Returns the remainder | |||||
The Mod command returns the remainder of the Integer division of number1 by number2.
Notes:
You can also use the % operator to calculate the remainder (see _O_C_TIME).
WARNING: The % operator returns valid results with Integer and Long Integer expressions. To calculate the modulo of real values, you must use the Mod command.
The following example illustrates how the Mod function works with different arguments. Each line assigns a number to the vlResult variable. The comments describe the results:
vlResult:=Mod(3;2) ` vlResult gets 1
vlResult:=Mod(4;2) ` vlResult gets 0
vlResult:=Mod(3.5;2) ` vlResult gets 0
Product: 4D
Theme: Math
Number:
98
Created: < 4D v6
4D Language Reference ( 4D v20 R7)