Atom

remove()

Deletes an entry or removes a positional element.

Signature

remove(collection, key)

Parameters

Mutable array, dictionary, hybrid or growable owning packed array, and a key or index.

Returns

The old value. Missing associative keys return null. A removed packed compound element has independent storage.

Behavior

Later dense elements shift down. Packed removal invalidates existing views.

Errors

Out-of-bounds positional index, unsupported receiver, or pinned/fixed/borrowed packed sequence.

Example

Atom
a = [1, 2]
assert(remove(a, 0) == 1 and a[0] == 2)