Back to FabImage Studio website

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

GetArrayElement


Module: FoundationLite

Extracts a single element from an array at the specified index.

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 outValue <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

  • Make sure that inIndex will always be in range. If this cannot be guaranteed, use GetArrayElement_OrNil instead.
  • To get the last element of a non-empty array use inIndex = 0 and inInverse = True.

Examples

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

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

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 Index out of range in GetArrayElement.
DomainError Negative index in GetArrayElement.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of GetArrayElement filter group.

See Also