# aset Set the element at index `$idx` in a mutable array (in place, O(1)) and return the array. Also accepts vectors, whose backing store is updated in place; an out-of-range index is a silent no-op. ## Syntax
[aset $coll $idx $val]
## Parameters - `$coll` — Array (from `array`/`array-of`) or vector. - `$idx` — Zero-based index (number). - `$val` — Value to store. ## Examples
def a [array 1 2 3]
[aset $a 1 99]        # → @{1 99 3}
[aget $a 1]           # → 99
[aset @{1 2 3} 9 0]   # → @{1 2 3}  (out of range, unchanged)
## Returns The mutated array (same object) for arrays and vectors; nil when `$coll` is not an array/vector. `%Err{:message expected number argument}` when `$idx` is not a number. ## See Also `aget`, `array`, `set-nth`