SplitScript reference / [T] / push

[T].push

Method

[T].push(value: T) -> None

Appends an element to a growable array.

Capacity grows geometrically when needed, while the array value keeps the same identity so every alias observes the appended element. Exact [T; N] arrays cannot change length and do not support push. Appending through any alias invalidates active iteration of this array.

Parameters

  • value: The element to append.

Effects: allocates, mutates the receiver

Runtime behavior: available everywhere; synchronous

Examples

Append a discovered checkpoint

let checkpoints: [u32] = [1, 2]
checkpoints.push(3)