Function Min() Foundation
Determines the smaller of two numeric or two date values.
Syntax
Min( <ndExpression1>, <ndExpression2> ) --> ndMin
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 Min() is the smaller of the two arguments.
Description
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.
Examples
// 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
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.