Arrays

An array is a group of values referenced by the same variable name. 
Each element in an array is referenced by an array variable that is a subscripted integer or an integer expression. 
The subscript is enclosed within parentheses.

 

Dim A(10) : Rem A is an array of ten elements

A(0)=1.0  : Rem A(0) is first element, A(9) the last one

nuBASIC supports single dimension arrays.

An array must be declared explicitly using construct Dim.
In an array declaration the array name is followed by parentheses which contain the specifications for the number of elements. 
The first element of an array has index 0 and the last one has index equal to length of the array decreased by one.

The byte-array represents raw type which can be used for containing any data content type.
A data buffer can be declared using the statement Dim or ReDim.

Dim Buf@(1024)     : Rem A is an array of bytes

Print SizeOf(BUF@) : Rem Prints out 1024

 See also Dim

Comments