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