UBound: Difference between revisions
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 ..." |
|||
(8 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.'' | |||
''' | 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. If the array is empty, -1 is returned. (For Android 2.1, use array.length instead.) | ||
== Example (Basic) == | |||
<pre> | <pre> | ||
Rem UBound Example | |||
' | 'UBound returns upper bound of array dimension | ||
Other = | 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) | |||
</pre> | </pre> | ||
== Output == | |||
<pre> | <pre> | ||
Line 27: | Line 30: | ||
</pre> | </pre> | ||
== Related Items == | |||
[[array|Array]], [[dim|Dim]], [[lbound|LBound]], [[redim|ReDim]] | |||
[[Category:Language Reference]] | |||
[[Category:Variable Handling]] | |||
[[ | [[Category:BASIC Functions]] |
Latest revision as of 15:38, 25 March 2019
This function is for BASIC compatibility. It is not available in pure JavaScript projects.
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. If the array is empty, -1 is returned. (For Android 2.1, use array.length instead.)
Example (Basic)
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