OxL Reference

method List.max

The largest element, or none for an empty list.

Example:

oxl✓ checked in CI
fn main() io {
  let xs: List<f32> = [1.5, 2.5, 4.0]
  let nothing: List<f32> = []
  print("{xs.max()} {nothing.max()}")
}
Output
4.0 none
pub(api) fn max() -> f32?

Complexity. O(n).

Since. 1.0.0-beta

Returns

f32?

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/numbers.oxl:5627

See also