Function: Min
Function: Min

Function: Min

Min ( VALUE1, VALUE2 )

Returns the lesser of two values.

Parameters

Parameter Type Description
VALUE1 VALUE The first value.
VALUE2 VALUE The second value.

Returns

VALUE The lesser value.

What It Does

This function returns the lesser of the two provided values, comparatively. If both values are different types, they are interpreted as the value of the highest type, promotion-wise (if one value is a string, and the other is not, they are compared as strings). The type of the returned value is the same type as the lesser value.


	a = min(-2, 2);             // a = -2
	a = min(6, 3.4);            // a = 3.4
	a = min("apple", "orange");	// a = "apple"
	a = min("apple", "Apple");	// a = "Apple"
	a = min(123, "pears");	    // a = 123

See Also

Max — Returns the greater of two values.

Additional Technical Notes

Strings are compared lexicographically, which is character-order (not alphabetical). The sorting is based on the character values, not any kind of locale-based or linguistic significance.

×

Modal Header