Array: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
ARRAY(''expressionlist'')
Array(''expressionlist'')


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


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.


<tabber>
JavaScript=
<syntaxhighlight lang="JavaScript">
//Array Example
//Array creates an array dynamically


'''Example'''
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]);
</syntaxhighlight>
|-|
BASIC=
<syntaxhighlight lang="vb.net">
'Rem Array Example
'Array creates an array dynamically


<pre>
Dim MyArray, Message
REM ARRAY Example
'ARRAY creates an array dynamically
DIM MyArray, Message
'Create an array with 2 string elements
'Create an array with 2 string elements
MyArray = Array("Hello", "World!")
MyArray = Array("Hello", "World!")
'Access the array and concatenate elements
'Access the array and concatenate elements
PRINT MyArray(0) & " " & MyArray(1)
Print MyArray(0) & " " & MyArray(1)
</pre>
</syntaxhighlight>
'''Output'''
</tabber>
 
== Output ==


<pre>
<pre>
Line 23: Line 37:
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[dim|Dim]], [[lbound|LBound]], [[redim|ReDim]], [[sort|Sort]], [[splice|Splice]], [[split|Split]], [[ubound|UBound]]
 
[[Category:Language Reference]]


[[dim|DIM]]
[[Category:Variable Handling]]

Latest revision as of 13:25, 24 July 2019

Array(expressionlist)

Description

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)

Output

Hello World!

Related Items

Dim, LBound, ReDim, Sort, Splice, Split, UBound