SplitScript reference / Index / at

Index.at

Method

Self.at(key: Key) -> Value where Self: Index

Reads the value selected by a key.

Bracket indexing dispatches to this operation. The standard array and map implementations trap for an invalid index or absent key.

Parameters

  • key: Key selecting one value.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Read through an index

let first = [10, 20].at(0)