# dim

## Syntax

    dim arrayName [ dimensions ]

## Description

You are able to create arrays with up to five dimensions. Arrays are best visualized as a line of boxes. Within each of these boxes are even smaller boxes. Contained within each of these smaller boxes are single items of data. To locate the data contained in one of these boxes, you must indicate exactly which box you wish to read from or write to. Each box has what is called an index number. Starting with the largest boxes, you provide an index number that takes you inside a box. You can then provide another index number that chooses one of the smaller boxes within the larger box. Every time you enter a new box, you are in fact indexing a new dimension in the array. Using this method of indexing the array elements, you can read and write to any value within the array. You can store only one type of data per array. Data types include integer numbers, real numbers and strings.

## Example

    rem example 1
    dim myValues [ 3 ]
    myValues [ 0 ] = 10
    myValues [ 1 ] = 20
    myValues [ 2 ] = 30
    print ( myValues [ 0 ] )
    print ( myValues [ 1 ] )
    print ( myValues [ 2 ] )

    rem example 2
    dim myValues [ 3 ] = [ 12, 492, 450 ]
    print ( myValues [ 0 ] )
    print ( myValues [ 1 ] )
    print ( myValues [ 2 ] )

    rem example 3
    dim myValues [ 3 ] as float = [ 1.2, 1.3, 1.4 ]
    print ( myValues [ 0 ] )
    print ( myValues [ 1 ] )
    print ( myValues [ 2 ] )

    rem example 4
    dim myValues [ 3 ] as string = [ "abc", "def", "ghi" ]
    print ( myValues [ 0 ] )
    print ( myValues [ 1 ] )
    print ( myValues [ 2 ] )

## Version 2

Version 2 introduced some new features for arrays, you can view them here.