SplitScript reference / IndexAssign / set

IndexAssign.set

Method

Self.set(key: Key, value: Value) -> None where Self: IndexAssign

Stores a value selected by a key.

Plain bracket assignment invokes only this operation. Compound assignment reads with Index.at, applies its operator, then invokes this operation, evaluating the receiver and key once.

Parameters

  • key: Key selecting the destination.
  • value: New value to store.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Assign through an index

let values = [10, 20]
values.set(0, 30)