The starting point of your table is specified by the a$(0) parameter, and it must always be set to the first item in the array, which is item number zero. For example:
E> N=5 : P=0 Dim A(N) Print "Type in ";N," numbers, or enter 0" Print "to stop entry and begin sort" Repeat Input A(P) If A(P)=0 Dec P Exit End If If P=N-1 Then Exit Inc P Until False Sort A(0) For X=N-P To N Print A(X) Next X
MATCH
function: search an array for a value
x=Match(array(0),value)
x=Match(array#(0),value#)
x=Match(array$(0),value$)
MATCH searches through an array that has already gone through the SORT process, looking for a given value. If the value is found then x is loaded with the relevant index number. However, if the search is not successful the result will be negative. If you take the absolute value of this result, the item which came closest to your original search parameter is provided. Only arrays with a single dimension can be checked in this way, and they must already be sorted before MATCH can be called.
For example:
E> Read N : Dim D$(N) For X=0 To N-1 : Read D$(X) : Next X Sort D$(0) Do REINPUT: Input A$ If A$=" "Then End If A$="print all data" For X=1 To N: Print D$(X) : Next X: Goto REINPUT End If