Skip to main content
element(list, index) returns the element at position index in list. The index wraps around: if index is greater than the list length, it cycles back to the beginning.

Signature

Example

Assign each build to one of several artifact storage buckets in a round-robin fashion using the build number:
Build 0 goes to artifacts-a, build 1 to artifacts-b, build 3 back to artifacts-a, and so on.

Notes

  • index wraps using modulo arithmetic, so it never produces an out-of-bounds error.
  • To get the last element without knowing the length, use element(list, length(list) - 1).