Skip to main content

Vector.at

atindex

Group: Selections

Documentation

Gets an element from the vector at a specified index (0-based).

Arguments

  • index: The location in the vector to get the element from. The index is also allowed be negative, then the elements are indexed from the back of the vector, i.e. -1 will correspond to the last element.

Examples

Get the second element of a vector.

      [1, 2, 3].at 1 == 2

Get the last element of a vector.

      [1, 2, 3].at -1 == 3