JavaScript Editor js editor     Web development 



Main Page

Evaluates a set of expressions and returns the expression with the minimum value.

MIN(eExpression1, eExpression2 [, eExpression3 ...])

Parameters

eExpression1, eExpression2[, eExpression3...]


Specify the set of expressions from which you want MIN(В ) to return the expression with the lowest value. All the expressions must be of the same type.

Return Value

Character, Numeric, Currency, Double, Float, Date, or DateTime

Example

The following example uses APPEND BLANK to create a table with 10 records containing random values, then uses MIN(В ) and MAX(В ) to display the maximum and minimum values in the table.

В Copy Code
CLOSE DATABASES
CREATE TABLE Random (cValue N(3))
FOR nItem = 1 TO 10  && Append 10 records,
   APPEND BLANK
   REPLACE cValue WITH 1 + 100 * RAND( )  && Insert random values
ENDFOR

CLEAR
LIST  && Display the values
gnMaximum = 1  && Initialize minimum value
gnMinimum = 100  && Initialize maximum value
SCAN 
   gnMinimum = MIN(gnMinimum, cValue)
   gnMaximum = MAX(gnMaximum, cValue)
ENDSCAN
? 'The minimum value is: ', gnMinimum  && Display minimum value
? 'The maximum value is: ', gnMaximum  && Display maximum value

See Also



JavaScript Editor js editor     Web development