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




 
Example code : A simple example
var
  int : Integer;

begin
  // Divide a primary integer by 2 - it discards the remainder
  int := 17 Div 2;

  ShowMessage('17 div 2 = '+IntToStr(int));
end;
Show full unit code
  17 div 2 = 8
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page