NAME

ubound - return upper bound for array subscripts

SYNOPSIS

v = ubound(ArrayName[, NumExpr])

DESCRIPTION

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. 

EXAMPLE

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
	    wend
	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

SEE ALSO

lbound

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber