Returns the minimum element in the sequence.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Available when Element conforms to Comparable.
Return Value
The sequence’s minimum element. If the sequence has no elements, returns nil
.
Discussion
This example finds the smallest value in an array of height measurements.
Complexity: O(n), where n is the length of the sequence.