SplitScript reference / [T] / extend

[T].extend

Method

[T].extend(values: [T]) -> None

Appends every element from another array.

The source length is captured before appending, so extending an array with itself duplicates its original elements exactly once. The receiver keeps its identity and grows with the same amortized behavior as push. Exact [T; N] arrays cannot change length and do not support extend. Extending through any alias invalidates active iteration of the receiver.

Parameters

  • values: The elements to append, in order.

Effects: allocates, mutates the receiver

Runtime behavior: available everywhere; synchronous

Examples

Append discovered checkpoints in bulk

let checkpoints: [u32] = [1, 2]
checkpoints.extend([4, 7, 9])