//Array Example
//Array creates an array dynamically
var MyArray, Message;
//Create an array with 2 string elements
MyArray= new Array("Hello", "World!");
//Access the array and concatenate elements
NSB.Print(MyArray[0] + " " + MyArray[1]);
(11 intermediate revisions by 3 users not shown) | |||
Line 5: | Line 5: | ||
Array creates an array dynamically. The required parameter, ''expressionlist'', is a comma-delimited list of valid expressions. The resulting array has a length equal to the number of elements in ''expressionlist''. Arrays created with Array have a lower bound of 0. | Array creates an array dynamically. The required parameter, ''expressionlist'', is a comma-delimited list of valid expressions. The resulting array has a length equal to the number of elements in ''expressionlist''. Arrays created with Array have a lower bound of 0. | ||
== Example | <tabber> | ||
JavaScript= | |||
<syntaxhighlight lang="JavaScript"> | |||
//Array Example | |||
//Array creates an array dynamically | |||
< | var MyArray, Message; | ||
Rem Array Example | //Create an array with 2 string elements | ||
MyArray= new Array("Hello", "World!"); | |||
//Access the array and concatenate elements | |||
NSB.Print(MyArray[0] + " " + MyArray[1]); | |||
</syntaxhighlight> | |||
|-| | |||
BASIC= | |||
<syntaxhighlight lang="vb.net"> | |||
'Rem Array Example | |||
'Array creates an array dynamically | 'Array creates an array dynamically | ||
Dim MyArray, Message | Dim MyArray, Message | ||
'Create an array with 2 string elements | 'Create an array with 2 string elements | ||
Line 15: | Line 28: | ||
'Access the array and concatenate elements | 'Access the array and concatenate elements | ||
Print MyArray(0) & " " & MyArray(1) | Print MyArray(0) & " " & MyArray(1) | ||
</ | </syntaxhighlight> | ||
</tabber> | |||
== Output == | == Output == | ||
Line 25: | Line 39: | ||
== Related Items == | == Related Items == | ||
[[dim|Dim]] | [[dim|Dim]], [[lbound|LBound]], [[redim|ReDim]], [[sort|Sort]], [[splice|Splice]], [[split|Split]], [[ubound|UBound]] | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Variable Handling]] | [[Category:Variable Handling]] |
Array(expressionlist)
Array creates an array dynamically. The required parameter, expressionlist, is a comma-delimited list of valid expressions. The resulting array has a length equal to the number of elements in expressionlist. Arrays created with Array have a lower bound of 0.
//Array Example
//Array creates an array dynamically
var MyArray, Message;
//Create an array with 2 string elements
MyArray= new Array("Hello", "World!");
//Access the array and concatenate elements
NSB.Print(MyArray[0] + " " + MyArray[1]);
'Rem Array Example
'Array creates an array dynamically
Dim MyArray, Message
'Create an array with 2 string elements
MyArray = Array("Hello", "World!")
'Access the array and concatenate elements
Print MyArray(0) & " " & MyArray(1)
Hello World!