SortArray (Function)

image\trumpet2.gif Disclaimer

The SortArray function sorts the values of a one-dimensional array in either ascending or descending order.

Syntax

SortArray(PriceArray, Size, HiLo)

Returns (Double)

The order of values of the array specified in PriceArray are changed as the result of running SortArray.  The SortArray function itself returns 1.

Parameters

Name

Type

Description

PriceArray

Numeric Array

Specifies the name of a numeric array containing values upon which the sort is performed.

Size

Numeric

Sets the number of data elements (size) in the array to evaluate.

HiLo

Numeric

Sets the sort order.   1 = sort descending,   -1 = sort ascending

Remarks

This function is used to change the order of values in an array by sorting them in a specified order.

The value for the Size input parameter should always be a whole number greater than 0 and is typically equal to the number of data elements in the array.

The SortArray function only works with one-dimensional arrays.  All array-based referencing begins with array element 1.

Example

Performs an ascending sort of the user declared array..

Array: myArray[30](0);

{… (assign values to array) }

Value1 = SortArray(myArray, 30,-1);