Back to Aurora Vision Studio website

You are here: Start » Filter Reference » Array » Array Basics » GetArrayElement_OrNil

GetArrayElement_OrNil


Module: FoundationLite

Extracts a single element from an array at the specified index; returns NIL if the index is out of range.

Name Type Range Description
Input value inArray <T>Array Input array
Input value inIndex Integer 0 - Index within the array
Input value inInverse Bool Determines if the indices are counted from beginning or from end of the input array
Output value outConditionalValue <T>? Element from the array

The type of this filter is defined using the type variable T which represents any valid type. Read more.

Hints

  • If you can guarantee that inIndex will always be in range, use GetArrayElement instead.
  • To get the last element of an array use inIndex = 0 and inInverse = True.

Examples

inArray = {1, 4, 3, 2, 5}
inIndex = 3
outValue = 2

inArray = {1, 4, 3, 2, 5}
inIndex = 5
outValue = Nil

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Negative index in GetArrayElement_OrNil.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of GetArrayElement filter group.

See Also