CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Variables > Array Subscripts

Array Subscripts

Arrays can be declared with default or defined boundaries known as bounds. Unless specifically defined in the array declaration statement, default lower bound settings are used. The default lower bound is zero, unless set by the module option base statement setting.

CitectVBA does not have an arbitrary upper bound on array dimensions. The upper bound of the array dimension must be defined before the array can be used. All bound values must be whole integers.

Subscripts are contained within one set of parentheses positioned immediately after the array name in the array declaration statement.

Subscripts are used to specify the bounds of each dimension of an array when the array is declared. If a single value is used, for instance (5), this represents the upper bound for that dimension of the array. If a range is specified, for instance (1 to 9), this specifies both the lower and upper bounds for that dimension of the array. If more than one subscript is used, for instance ( 5, 1 To 9), each subscript must be separated by a comma, and each subscript represents a separate dimension of the array.

The syntax of an array subscript range consists of a numeric value range separated by the to clause:

(<LowerBound> To <UpperBound>)


See Also

Fixed Size Arrays

Multi-Dimensional Arrays

Dynamic Size Arrays

Arrays of Variables