array_ref


array_ref(a, i)
      

Return the element at the (zero-based) ith position of the array a. The argument i may also be a list of integers that indicates the position inside a multi-dimensional array.

The ith element can be also accessed using the array reference operator as, a[i].

Array_ref and [] will raise an "Out of range" error if i < 0 or i >= array_length(a).

Examples:


let a = #[#[1, 2], #[3, 4]]
array_ref(a, 0)
// #[1, 2]
array_ref(a, [1, 0])
// 3
a[1][1]
// 4
      

Also see:

array_at
array_set


Core Module Index | Contents