From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 7: | Line 7: | ||
<b>Example</b><br> | <b>Example</b><br> | ||
In the example, it will return the remainder of dividing 20 by 12. So as a result you will see the value 8 on the screen.<br> | In the example, it will return the remainder of dividing 20 by 12. So as a result you will see the value 8 on the screen.<br> | ||
<pre> | <pre> | ||
var | var | ||
| Line 19: | Line 19: | ||
} | } | ||
</pre> | </pre> | ||
Revision as of 12:17, 13 November 2024
keyword Mod
The mod keyword returns the remainder of the division of two numbers. The integer result of the division is ignored.
Example
In the example, it will return the remainder of dividing 20 by 12. So as a result you will see the value 8 on the screen.
var
dividingNumber,divisor,remainder : Integer;
{
dividingNumber = 20;
divisor = 12;
remainder = dividingNumber Mod divisor;
ShowMessage(IntToStr(dividingNumber)+' Mod '+IntToStr(divisor)+' :'+IntToStr(remainder));
}
Output:
20 Mod 12 : 8