DelphiBasics
 MaxFunction Gives the maximum of two integer values Math unit
 function Max ( const A, B : Integer|Int64|Single|Double|Extended ) : Integer|Int64|Single|Double|Extended;
Description
The Max function returns the value of higher of two numeric arguments, A and B.

These arguments may be any of the given numeric types, in any mixture. The result will be normalised to the appropriate value - floating point if either argument is floating point.
Related commands
 Mean Gives the average for a set of numbers Min Gives the minimum of two integer values CompareValue Compare numeric values with a tolerance

 Example code : Illustrate integer use of Max var   int1, int2, int3 : Integer; begin   int1 := 37;   int2 := 38;   int3 := Max(int1, int2);   ShowMessage('int1 = '+IntToStr(int1));   ShowMessage('int2 = '+IntToStr(int2));   ShowMessage('Max(int1, int2) = '+IntToStr(int3)); end; Show full unit code int1 = 37   int2 = 38   Max(int1, int2) = 38 Example code : Illustrating Max of mixed number types // Full Unit code.// -----------------------------------------------------------// You must store this code in a unit called Unit1 with a form// called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses  Math,   // Unit containing the Max command  SysUtils,  Forms, Dialogs; type  TForm1 = class(TForm)    procedure FormCreate(Sender: TObject);  end; var  Form1: TForm1; implementation{\$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var   int1   : Integer;   float1 : single; begin   int1   := 37;   float1 := 37.5;   float1 := Max(float1, int1);   ShowMessage('Max(float1, int1) = '+FloatToStr(float1)); end; end. Hide full unit code Max(float1, int1) = 37.5