Array
Previous Top Next

The Array keyword is used to initialize arrays and structures with the specified data.
It supports arrays of one and two dimensions and array structures of one dimension.
Arrays and structures should first be declared in Sub Globals.
However the size of the array can be set to 0 as the Array keyword will reinitialize the array.
Syntax: Array (Array Elements)

The following example demonstrates the syntax of Array:
Sub Globals
      Dim Primes(0)
      Dim Matrix(0,0)
      Dim Type (x,y) Points(0)
End Sub

Sub App_Start
      Primes() = Array(2,3,5,7,11,13,17,19)
      'Primes size is 8.
      Matrix() = Array((20,30),(12*32-3,98),(1,1))
      'Matrix size is (3,2). Matrix(0,0) = 20, Matrix(0,1) = 30
      Points() = Array((30,10),(25,9),(87,34))
      'Points size is 3. Points(0).x = 30, Points(0).y = 10
End Sub