LBound: Difference between revisions
Jump to navigation
Jump to search
Add javascript snippet |
|||
Line 5: | Line 5: | ||
LBound returns a long value specifying the smallest available subscript in dimension of an array, ''array''. The required parameter, ''array'', is any array variable. The optional parameter, ''dimension'', specifies which dimension's lower bound is returned, beginning with the default, 1. The lower bound of any dimension of an array is always 0. | LBound returns a long value specifying the smallest available subscript in dimension of an array, ''array''. The required parameter, ''array'', is any array variable. The optional parameter, ''dimension'', specifies which dimension's lower bound is returned, beginning with the default, 1. The lower bound of any dimension of an array is always 0. | ||
== Example == | == Example (Basic) == | ||
<pre> | <pre> | ||
Line 15: | Line 15: | ||
Print "'Children' Lower Bound:", LBound(Children, 1) | Print "'Children' Lower Bound:", LBound(Children, 1) | ||
Print "'Parents' Lower Bounds:", LBound(Parents), LBound(Parents, 2) | Print "'Parents' Lower Bounds:", LBound(Parents), LBound(Parents, 2) | ||
</pre> | |||
== Example (JavaScript) == | |||
<pre> | |||
// LBound Example | |||
/* LBound returns lower bound of array dimension */ | |||
LBound = function(arr, dm) { | |||
return 0; //JavaScript always begins with 0 | |||
} | |||
var Other, Children=new Array(3), Parents=new Array(3,1); | |||
Other = new Array("Damien" , "Pip" , "Wendy"); | |||
NSB.Print("'Other' Lower Bound: " + LBound(Other)); | |||
NSB.Print("'Children' Lower Bound: " + LBound(Children, 1)); | |||
NSB.Print("'Parents' Lower Bounds: " + LBound(Parents)+ " " + LBound(Parents, 2)); | |||
</pre> | </pre> | ||
Revision as of 01:27, 28 May 2013
LBound(array[, dimension])
Description
LBound returns a long value specifying the smallest available subscript in dimension of an array, array. The required parameter, array, is any array variable. The optional parameter, dimension, specifies which dimension's lower bound is returned, beginning with the default, 1. The lower bound of any dimension of an array is always 0.
Example (Basic)
Rem LBound Example 'LBound returns lower bound of array dimension Dim Other, Children(3), Parents(3, 1) Other = Array("Damien", "Pip", "Wendy") Print "'Other' Lower Bound:", LBound(Other) Print "'Children' Lower Bound:", LBound(Children, 1) Print "'Parents' Lower Bounds:", LBound(Parents), LBound(Parents, 2)
Example (JavaScript)
// LBound Example /* LBound returns lower bound of array dimension */ LBound = function(arr, dm) { return 0; //JavaScript always begins with 0 } var Other, Children=new Array(3), Parents=new Array(3,1); Other = new Array("Damien" , "Pip" , "Wendy"); NSB.Print("'Other' Lower Bound: " + LBound(Other)); NSB.Print("'Children' Lower Bound: " + LBound(Children, 1)); NSB.Print("'Parents' Lower Bounds: " + LBound(Parents)+ " " + LBound(Parents, 2));
Output
'Other' Lower Bound:0 'Children' Lower Bound: 0 'Parents' Lower Bounds: 0 0