DelphiBasics
Mod
Keyword
Performs integer division, returning the remainder
 keyword Mod(Dividend Mod Divisor
Description
The Mod keyword gives the remainder from dividing the Dividend by the Divisor.
 
The whole number result of the division is ignored.
Related commands
DivPerforms integer division, discarding the remainder
 Download this web site as a Windows program.




 
Example code : A simple example
var
  int : Integer;

begin
  // Divide a primary integer by 4 - Mod returns the remainder
  int := 19 Mod 4;

  ShowMessage('19 mod 4 = '+IntToStr(int));
end;
Show full unit code
  19 mod 4 = 3
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page