SplitScript reference / [T] / remove

[T].remove

Method

[T].remove(value: T) -> bool where T: Equatable

Removes the first element equal to a value.

Returns whether an element was removed. Elements are searched from the beginning, duplicates after the first match remain in place, and an absent value leaves the array unchanged. The receiver keeps its identity and capacity. Exact [T; N] arrays cannot change length and do not support [T].remove.

Parameters

  • value: The first equal element to remove.

Effects: mutates the receiver

Runtime behavior: available everywhere; synchronous

Examples

Consume one completed checkpoint

let pendingCheckpoints = ["forest", "castle"]
let removed = pendingCheckpoints.remove("forest")