FANDOM


This command will create an array in which you can store your program data.

Syntax
DIM ArrayName(Array Dimensions)
Parameters
ArrayName(Array Dimensions

Value
Enter the appropriate value here.

Returns

This command does not return a value.

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. To free an array created this way, use the UNDIM command.

Example Code
DIM array(10)

array(0)=42

array(1)=24

PRINT array(1)

PRINT array(0)

WAIT KEY