Function Min() Foundation
Determines the smaller of two numeric or two date values.
Min( <ndExpression1>, <ndExpression2> ) --> ndMin
The return value of Min() is the smaller of the two arguments.
Min() determines the minimum 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 Min() is the function Max(), which returns the greater of two values.
// The example shows various results of the function Min().
PROCEDURE Main
? Min(4, 7) // result: 4
? Min(7, 4) // result: 4
? Date() // result: 12/06/94
? Min( Date(), CtoD("12/24/93") ) // result: 12/24/93
RETURN
// In this example the file size of the smallest PRG file
// and the date of the oldest PRG file are determined.
// Symbolic constants from the header file Directry.ch
// are used.
#include "Directry.ch"
PROCEDURE Main
LOCAL aPrgFiles := Directory("*.PRG")
LOCAL nMinSize := 10**10
LOCAL dOldest := Date()
AEval( aPrgFiles, ;
{|a| nMinSize := Min( nMinSize, a[F_SIZE] ), ;
dOldest := Min( dOldest , a[F_DATE] ) } )
? nMinSize, dOldest
RETURN
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.