ubound - return upper bound for array subscripts


v = ubound(ArrayName[, NumExpr])


The ubound function returns the upper bound for subscripts along a dimension of an array.  ArrayName is the name of the array, without the subscripts and parentheses normally used in an array reference.  NumExpr is a numeric expression which gives the number of the dimension.  Dimensions are numbered in order of their appearance starting with one.  NumExpr is unnecessary and may be omitted for one dimensional arrays. 


The subprogram
	sub sort(a(1)) static
	    static gap, i, j, a

	    gap = ubound(a) \ 2
	    while gap > 0
		for i = gap + 1 to ubound(a)
		    for j = i - gap to 1 step -gap
			if a(j) <= a(j + gap) then
				j = 0
			else	a = a(j)
				a(j) = a(j + gap)
				a(j + gap) = a
			end if
		    next j
		next i
		gap = gap \ 2
	end sub
performs the Shell sort on a list of numbers.  The length of the list need not be passed explicitly to the routine since it can be determined using ubound



from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber