Array.at
atindex
Group: Selections
Documentation
Gets an element from the array at a specified index (0-based).
Arguments
index
: The location in the array to get the element from. The index is also allowed be negative, then the elements are indexed from the back of the array, i.e. -1 will correspond to the last element.
Examples
Get the second element of an array.
[1, 2, 3].to_array.at 1 == 2
Get the last element of an array.
[1, 2, 3].to_array.at -1 == 3