Generic Function

min(_:_:_:_:)

Returns the least argument passed.

Declaration

func min<T>(_ x: T, _ y: T, _ z: T, _ rest: T...) -> T where T : Comparable

Parameters

x

A value to compare.

y

Another value to compare.

z

A third value to compare.

rest

Zero or more additional values.

Return Value

The least of all the arguments. If there are multiple equal least arguments, the result is the first one.

See Also

Choosing the Smallest and Largest Value

func min<T>(T, T) -> T

Returns the lesser of two comparable values.

func max<T>(T, T) -> T

Returns the greater of two comparable values.

func max<T>(T, T, T, T...) -> T

Returns the greatest argument passed.