CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Variables > Arrays of Variables

Arrays of Variables

Arrays of variables allow you to group like variables together, somewhat similar to the grouping of like items in fields of a database. An array is an ordered group of variables of the same name, containing values of the same data type. Individual member elements of the array are identified by a separate index number. Arrays in CitectVBA start their indexing sequence by default at zero. This default base value can be changed in a CitectVBA file module by using the option base statement.

CitectVBA supports single and multi-dimension arrays of variables. CitectVBA creates single dimension arrays by default. Multi-dimension arrays must be specifically declared.

CitectVBA allocates memory space for each element of the array. To minimize the amount of memory used storing arrays, and to minimize the time required to access array data, arrays should not be declared any larger than required.

All elements in an array must be of the same data type. CitectVBA supports arrays of bytes, booleans, longs, integers, singles, doubles, strings, and variants. For details about CitectVBA data types, see CitectVBA Data Types.

Arrays declared in a sub or function procedure have local scope only within that procedure. An array declared outside a procedure has modular (global) scope to all procedures within the project.

Note: CitectVBA arrays cannot be used directly in CitectSCADA command or expression fields. Also, CitectVBA does not support user-defined data types.

Arrays declared (using the dim statement within procedures,) do not retain their values between procedure calls in CitectVBA.

See Also

Fixed Size Arrays

Multi-Dimensional Arrays

Dynamic Size Arrays