method List.remove
Removes and returns the element at index i; later elements move one place down.
Example:
fn main() io {
var xs = [10, 20, 30]
let x = xs.remove(1)
print("{x} {xs}")
}Output
20 [10, 30]
Removes and returns the element at i. Panics when i is out of range.
Example:
fn main() io {
var xs = ["a", "b", "c"]
let b = xs.remove(1)
print("{b} {xs}")
}Output
b ["a", "c"]
pub(api) var fn remove(i: usize) -> TComplexity. O(n) in the number of elements after `i`.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
i | usize |
Returns
T
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/collections.oxl:241