Aurora Visio Studio TOP » Filter Reference » Array » Array Transforms » SwapArrayElements

SwapArrayElements


Module: FoundationLite

Swaps two elements of an array.

Name Type Range Description
Input will be modified
ioArray <T>Array
Input value
inIndex1 Integer 0 - Index of the first element being swapped
Input value
inIndex2 Integer 0 - Index of the second element being swapped
Input value
inInverse Bool Determines if the indices are counted from beginning or from end of the input array

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

Examples

inArray = {1,4,3,2,5}
inIndex1 = 0
inIndex2 = 4
outArray = {5,4,3,2,1}

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 SwapArrayElements.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

  • ReverseArray – Creates an array of the input array elements in reversed order.
  • RotateArray – Cyclically shifts the elements of an array.