OxL Reference

method List.clear

Removes all elements.

Example:

oxl✓ checked in CI
fn main() io {
  var xs = [1, 2, 3]
  xs.clear()
  print("{xs.len()}")
}
Output
0

Removes all elements.

Example:

oxl✓ checked in CI
fn main() io {
  var xs = [1, 2, 3]
  xs.clear()
  print("{xs.len()}")
}
Output
0
pub(api) var fn clear()

Complexity. O(n).

Since. 1.0.0-beta

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/collections.oxl:270

See also