Array Variables

An array variable is a variable that represents more than one data value. There are two types of array; dynamic arrays and dimensioned arrays.

Dynamic Arrays

A dynamic array is a mapping of the structure of file items to string data. Any string, however, can be considered a dynamic array.

A dynamic array is a string containing substrings that are separated by special delimiter characters. At the highest level, these elements are called attributes, and are separated by attribute marks (CTRL+^). Each attribute can contain values separated by value marks (CTRL+]). Each value can contain subvalues separated by subvalue marks (CTRL+\). Thus, an example of a dynamic array is as follows:

PETER THOMPSON]333-8989\232-8665^JOEFRIDAY]872-1789\865-0096

In this dynamic array string, there are two attributes:

PETER THOMPSON]333-8989\232-8665

JOE FRIDAY]872-1789\865-0096

there are four values:

PETER THOMPSON

333-8989\232-8665

JOE FRIDAY

872-1789\865-0096

and there are four subvalues:

333-8989

232-8665

872-1789

865-0096

The primary use of dynamic arrays is to store data that is either read from or written to a file item. Each line in a file item corresponds to a separate attribute. However, mvBASIC includes facilities for manipulating dynamic array elements that make dynamic arrays a powerful data type for processing information independently of file items.

Dynamic arrays are called arrays because they can be referenced by array functions using 3 subscripts, and they are called dynamic because elements can be added or deleted without having to recompile the program. Null attributes, values, and subvalues are represented by two consecutive attribute marks, value marks, or subvalue marks, respectively.

See Overview of mvBASIC Statements and Functions for more information on processing dynamic arrays.

See Also

Advanced Data Types

Dimensioned Arrays

File Variables

Select-list Variables