ArrayReverse

Reverses the order of the elements in a WIL array or a variant safearray in place.

Syntax:

ArrayReverse( array, [, dimension ] )

Parameters:

(a) array: array to reverse elements.

(i) dimension: [optional] array dimension to reverse 0 (default). Valid values are 1 to the number of dimensions in the passed in array or 0 to reverse the array without regard to dimension.

Returns:

(i) returns 1.

 

Reverses the order of the elements in a WIL array or a variant safearray in place. This function is primarily intended for use on single dimension arrays but it also accepts multi-dimensional arrays.  When the optional dimension parameter is used on a multi-dimensional array the reversal process is performed on blocks of elements within the array. The elements within each block are not reversed relative to each other.  For example, this feature can be used to reverse the perceived order of the columns in a two dimension array without changing the order of the elements within each column. The function always returns 1.

Example:
 
; Reverse Array
arrName = Arrayize( 'Apples,Bananas,Cherries,Grapes,Lemons,Limes,Nectarines,Oranges,Raspberries,Strawberries,Watermelon' )
ArrayReverse( arrName )
strName = ArrayItemize( arrName )
AskItemList('Fruit list reversed', list, @tab, @sorted, @single )
 
See Also:

Arrays, ArrayFileGet, ArrayFileGetCsv, ArrayFilePut, ArrayFilePutCsv, ArrayFromStr, ArrayInsert, ArrayItemize, Arrayize, ArrayLocate, ArrayRemove, ArrayReverse, ArraySort, ArraySwapElements, ArrayToStr, ArrDimension, ArrInfo, ArrInitalize, Drop