Skip to content

Max

Returns the largest of two values.

Declaration

Source position: math.pp line 226

function Max(a: Integer; b: Integer) : Integer;  overload; overload;
function Max(a: Int64; b: Int64) : Int64;  overload; overload;
function Max(a: QWord; b: QWord) : QWord;  overload; overload;
function Max(a: Single; b: Single) : Single;  overload; overload;
function Max(a: Double; b: Double) : Double;  overload; overload;
function Max(a: Extended; b: Extended) : Extended;  overload; overload;

Description

Max returns the largest of the two values in the a and b arguments. The overloaded routines use the same type for both of the compared arguments. The type for the first argument determines the overloaded function used for the comparison.

Errors

None.

See also

Name Description
min Return smallest of two values.
maxIntValue Return largest element in integer array.
maxvalue Return largest value in array.

Example

Program Example24;

{ Program to demonstrate the max function. }

Uses math;

Var
  A,B : Cardinal;

begin
  A:=1;b:=2;
  writeln(max(a,b));
end.