method List.max
The largest element, or none for an empty list.
Example:
fn main() io {
let xs: List<u16> = [1, 2, 3, 4]
let nothing: List<u16> = []
print("{xs.max()} {nothing.max()}")
}Output
4 none
pub(api) fn max() -> u16?Complexity. O(n).
Since. 1.0.0-beta
Returns
u16?
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/numbers.oxl:5212