Skip to content

Element Access

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Element Access

Elements of an array-like value can be accessed using the [] operator and providing an index.

array_like[index]

Zero-Based Indices

All indices start at zero, so in order to retrieve the first element, you use the zeroth index:

array_like[0]

What Qualifies as an Array-like

Array-like values include:

  • Pointers
  • Fixed Arrays
  • List
  • Array
  • String
  • Other values that have a corresponding __access__ method

Result Value

The resulting value will be the mutable value at the supplied index

Clone this wiki locally