Function Max() Foundation
Determines the larger of two numeric or two date values.
Syntax
Max( <ndExpression1>, <ndExpression2> ) --> ndMax
Parameters
<ndExpression>
<ndExpression1> and <ndExpression2> are numeric or date values which are compared. Both must be of the same data type.
Return
The return value of Max() is the greater of the two arguments.
Description
Max() determines the maximum of two values. Two numeric or two date values can be compared. The data type of the return value is the same as the data type of the comparison values. The counterpart of Max() is the function Min() which returns the lesser of two values.
Examples
// The example shows various results of the function Max().
PROCEDURE Main
? Max(4, 7) // result: 7
? Max(7, 4) // result: 7
? Date() // result: 12/06/94
? Max( Date(), CtoD("12/24/94") ) // result: 12/24/94
RETURN
// In this example the file size of the largest DBF file
// and the date of the DBF file last used is determined.
// Symbolic constants from the header file Directry.ch
// are used.
#include "Directry.ch"
PROCEDURE Main
LOCAL aDbfFiles := Directory("*.DBF")
LOCAL nMaxSize := 0
LOCAL dLastDate := CtoD("")
AEval( aDbfFiles, ;
{|a| nMaxSize := Max( nMaxSize, a[F_SIZE] ), ;
dLastDate:= Max( dLastDate,a[F_DATE] ) } )
? nMaxSize
? dLastDate
RETURN
Feedback
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.