# Arrays

An array is a set of values that are logically related to each other. You refer to these values by the same variable name and use a number called an index or subscript to distinguish each individual value. These values are called the elements of the array and occupy a contiguous range from zero to a defined upper bound.

Variables other than arrays are referred to as scalars. A scalar can hold only one value at a time.

## Creating an array

You create an array using the same statements you use to create scalar variables. The only difference is the addition of the size of the array, which is placed inside parentheses in the examples below.

Listing 1
``````Dim myFirstArray(10)
``````

Because myFirstArray uses one index or subscript, it is called a onee-dimensional array. You also are able to create arrays with more than one subscript, commonly called multidimensional arrays. For more information, see Array Dimensions.

Describe

## Populating an array with initial values

You can give an array some initial values by using an array initializer. An array initializer consists of a list of values separated by commas and enclosed inside of curly braces ({ and }).

Listing
``````Dim days\$() = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }
``````

### Nesting initializers

You can create multidimensional arrays by nesting array initializers.

Listing
``````Dim magic() = {{4, 9, 2}, {3, 5, 7}, {8, 1, 6}}
``````

Describe

Describe

Describe