UBound: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "UBOUND(''array''[, ''dimension'']) '''Description''' UBOUND returns a long value specifying the largest available subscript in the specified dimension of a given array. The ...")
 
No edit summary
Line 1: Line 1:
UBOUND(''array''[, ''dimension''])
UBound(''array''[, ''dimension''])


'''Description'''
== Description ==


UBOUND returns a long value specifying the largest available subscript in the specified dimension of a given array. The required parameter, ''array'', is any array variable. The optional parameter, ''dimension'', specifies which dimension's upper bound is returned, beginning with the default, 1.
UBound returns a long value specifying the largest available subscript in the specified dimension of a given array. The required parameter, ''array'', is any array variable. The optional parameter, ''dimension'', specifies which dimension's upper bound is returned, beginning with the default, 1.


'''Example'''
== Example ==


<pre>
<pre>
REM UBOUND Example
Rem UBound Example
'UBOUND returnsupperboundofarraydimension
'UBound returns upper bound of array dimension
DIM Other, Children(3), Parents(3, 1)
Dim Other, Children(3), Parents(3, 1)
Other = ARRAY("Damien", "Pip", "Wendy")
Other = Array("Damien", "Pip", "Wendy")
PRINT "'Other' Upper Bound:", UBOUND(Other)
Print "'Other' Upper Bound:", Ubound(Other)
PRINT "'Children' Upper Bound:", _
Print "'Children' Upper Bound:", _
       UBOUND(CHILDREN, 1)
       UBound(Children, 1)
PRINT "'Parents' Upper Bounds:", _
Print "'Parents' Upper Bounds:", _
       UBOUND(Parents), UBOUND(Parents, 2)
       UBound(Parents), UBound(Parents, 2)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 27: Line 27:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[array|ARRAY]], [[dim|DIM]], [[lbound|LBOUND]], [[redim|REDIM]]
[[array|ARRAY]], [[dim|DIM]], [[lbound|LBOUND]], [[redim|REDIM]]
[[Category:Language Reference]]

Revision as of 04:08, 17 August 2012

UBound(array[, dimension])

Description

UBound returns a long value specifying the largest available subscript in the specified dimension of a given array. The required parameter, array, is any array variable. The optional parameter, dimension, specifies which dimension's upper bound is returned, beginning with the default, 1.

Example

Rem UBound Example
'UBound returns upper bound of array dimension
Dim Other, Children(3), Parents(3, 1)
Other = Array("Damien", "Pip", "Wendy")
Print "'Other' Upper Bound:", Ubound(Other)
Print "'Children' Upper Bound:", _
       UBound(Children, 1)
Print "'Parents' Upper Bounds:", _
       UBound(Parents), UBound(Parents, 2)

Output

'Other' Upper Bound:2
'Children' Upper Bound:    3
'Parents' Upper Bounds:    3      1

Related Items

ARRAY, DIM, LBOUND, REDIM