Link Search Menu Expand Document

Min

Description

The Min() method returns the smallest value in a list of values. If no argments are passed the Min() method will use the stored array. Returns Empty if array is uninitialized, or only contains non-scalar variables. If operating on a jagged or multi-dimensional array, the value returned will be the smallest value in all of the arrays combined.

Note

Multi-dimensional arrays assigned to the .Items property are converted to jagged arrays internally and will be treated as such by the Min() method.

Syntax

expression.Min([Args1[, Args2[, …[, ArgsN]]]])

Parameters

Name
Args
Type
ParamArray Variant
Necessity
Opional
Description
A list of values or an array to compare. If no arguments are provided the Min() method will return the smallest value on the stored array.

Returns

Type
Variant
Description
The smallest value in the array.

Example

Public Sub MinExample()
    Dim result As Long
    Dim MyArray As BetterArray
    Set MyArray = New BetterArray

    MyArray.Push 10, 1, 3, 5, 9, 12, 2, 8, 7
    result = MyArray.Min
    ' expected output:
    ' result  = 1
End Sub

Inspiration

Back to Docs