ArrayMin(array)

Description

Returns the smallest numeric value in an array.

Category

Array functions

Parameters

Parameter
Description
array
Name of an array from which to return the smallest numeric value

Example

<!--- This example shows the use of ArrayMin --->
<html>
<head>
<title>ArrayMin Example</title>
</head>

<body>
<H3>ArrayMin Example</H3>
<P>
This example uses ArrayMin to find the smallest number in an array.<BR> 
</P>

<!--------------------------------------------------------------------- 
After checking whether the form has been submitted, the following
code creates an array and assigns the form fields to the first two
elements in the array.
---------------------------------------------------------------------->

<cfif IsDefined("FORM.submit")>
    <cfset myNumberArray = ArrayNew(1)>
    <cfset myNumberArray[1] = FORM.number1>
    <cfset myNumberArray[2] = FORM.number2>
        
    <cfif Form.Submit is "Minimum Value">    
        <!--- use ArrayMin to find the smallest number in the array --->
        <P>The smallest number that you entered is
        <cfoutput>#ArrayMin(myNumberArray)#.</cfoutput>
    </cfif>    
</cfif>    

<!--------------------------------------------------------------------- 
The following form provides two numeric fields that are compared when
the form is submitted.
---------------------------------------------------------------------->
<form action = "arraymin.cfm" method = "post">

<input type = "hidden" name = "number1_Float">
<input type = "hidden" name = "number2_Float">
<input type = "text" name = "number1">
<BR>
<input type = "text" name = "number2">
<BR>
<input type = "submit" name = "submit" value = "Minimum Value">
</FORM>

</body>
</html>