# MOD/REM
Read Time: 1 minute(s)
Tags: mod rem mathematical operations
# Description
The MOD or REM functions return the arithmetic modulo of two numeric expressions. They take the general form:
MOD(expression1, expression2)
1
or
REM(expression1, expression2)
1
Where both expression1 and expression2 should evaluate to numeric expressions or a runtime error will occur.
The remainder of expression1 divided by expression2 calculates the modulo. If expression2 evaluates to 0, then the value of expression1 is returned.
An example of use is as below:
FOR inx = 1 TO 10000
IF MOD (inx, 1000) = 0 THEN
*perform a task
END
NEXT inx
1
2
3
4
5
2
3
4
5
Go back to jBASE BASIC
Go back to Programmers' Reference Guide