method Set.insert
True when x is in the set.
Example:
fn main() io {
var s = Set<i32>.new()
s.insert(5)
print("{s.contains(5)} {s.contains(6)}")
}Output
true false
Removes x; returns false when it was not in the set.
Example:
fn main() io {
var s = Set<i32>.new()
s.insert(1)
print("{s.remove(1)} {s.remove(1)}")
}Output
true false
Adds x; returns false when it was already in the set.
Example:
fn main() io {
var s = Set<i32>.new()
print("{s.insert(1)} {s.insert(1)}")
}Output
true false
pub(api) var fn insert(x: T) -> boolSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
x | T |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/collections.oxl:1045