To specify the maximum values for array variable subscripts and allocate storage accordingly.
If an array variable name is used without a DIM statement, the maximum value of its subscript(s) is assumed to be 10. If a subscript greater than the maximum specified is used, a "Subscript out of range" error occurs.
The maximum number of dimensions for an array is 255.
The minimum value for a subscript is always 0, unless otherwise specified with the OPTION BASE statement.
An array, once dimensioned, cannot be re-dimensioned within the program without first executing a CLEAR or ERASE statement.
The DIM statement sets all the elements of the specified arrays to an initial value of zero.
10 DIM A(20)
20 FOR I=0 TO 20
30 READ A(I)
40 NEXT I
This example reads 21 DATA statements elsewhere in the program and assigns their values to A(0) through A(20), sequentially and inclusively. If the A array is single precision (default accuracy) then line 10 will allocate 84 bytes of memory to this array (4 bytes times 21 elements).
All Frank Sinatra recordings, All Beatles albums, All solo albums from John Lennon, Paul McCartney, George Harrison and Ringo Starr, All Beatles songs, List of Platinum selling albums, Database with hits from 1950 to 1999.
Sought after DLL files, Nutworks magazine (retro), Worldwide ISO and TLD codes, File extensions database, The Hackers dictionary, Free software for the Atari, Amiga and Macintosh, Nokia smartphone, PocketPC, List of all BASIC programming language commands, List of all DOS commands, Free Advanced Bash-Scripting Guide (Linux-Unix)