OxL Reference

method Set.remove

Removes x; true when it was in the set.

Example:

oxl✓ checked in CI
fn main() io {
  var s: Set<i32> = Set.new()
  s.insert(5)
  print("{s.remove(5)} {s.remove(5)}")
}
Output
true false

Removes x; returns false when it was not in the set.

Example:

oxl✓ checked in CI
fn main() io {
  var s = Set<i32>.new()
  s.insert(1)
  print("{s.remove(1)} {s.remove(1)}")
}
Output
true false
pub(api) var fn remove(x: T) -> bool

Complexity. O(1) on average.

Since. 1.0.0-beta

Parameters

NameType
xT

Returns

bool

Effects

none declared (pure unless the body says otherwise)

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

See also