Function Reference


_ArrayReverse

Show description in

Takes the given array and reverses the order in which the elements appear in a 1D array

#include <Array.au3>
_ArrayReverse ( ByRef $aArray [, $iStart = 0 [, $iEnd = 0]] )

Parameters

$aArray Array to modify
$iStart [optional] Index of array to start modifying at
$iEnd [optional] Index of array to stop modifying at

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero.
@error: 1 - $aArray is not an array
2 - $iStart is greater than $iEnd
3 - $aArray is not a 1D array
4 - $aArray is empty

Related

_ArraySwap

Example

#include <Array.au3>

Local $avArray[10] = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayReverse()")
_ArrayReverse($avArray)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayReverse()")
_ArrayReverse($avArray, 3, 6)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayReverse() from index 3 to 6")