Documentation (c) 2006-2008 Hobby-Robotics, LLC


Arrays

Arrays are used to arrange values into a matrix. Array elements can be of SByte, Byte, Short, UShort, Integer, UInteger and Single types. Array can have multiple dimensions with specified index range. Maximum supported number of dimensions in the array is 3. Array element can be used in the same was as variable of the same type.

Arrays can be global or local and follow the same visibility rules as variables. Global arrays are limited in size by the available amount of memory. Local variables have size limited by the local stack limit.

Global arrays can be initialized when defined with Dim keyword.

Example:

' Array declaration

Dim arrayOfBytes1Dimension(1 To 32) As Byte

Dim arrayOfShorts2Dimensions(1 To 32, -1 To 10) As Short

' Array declaration with initialization

Dim arrayOfBytesInitialized(1 To 2) As Byte = {1, 2}

Dim arrayOfBytesInitialized(1) As Byte = {0, 1}

'Array element assignment

arrayOfBytes1Dimension(1) = 1

arrayOfBytes1Dimension(index) = 3

arrayOfShorts2Dimensions(1,-1) = 10

Wikipedia: Array