English
Language : 

NSB8 Datasheet, PDF (40/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
DIM
grifo®
ITALIAN TECHNOLOGY
STATEMENT:
DIM <list of array or string size declarations>
ACTION:
Reserves program/data area memory space for strings and arrays as specified in the declarations.
EXAMPLES:
10 DIM A$ (30) ,Q (100) ,Z (5,2)
60 DIM X7 (X,Y) ,X8 (X,X,X)
70 DIM C$ (100*3)
REMARKS:
A DIM statement automatically initializes the variables declared in it. After a DIM statement is
executed, the lenght of any string declared in it is equal to the declared size and all character positions
are filled with spaces. (For example, after executing line 10 above, A$ will be a 30-character string
filled with spaces.) All elements of any array declared in a DIM statement will be initialized to zero.
When declaring strings, the single numeric expression enclosed in parentheses specifies the
maximum number of characters which the string variable may hold. A declaration for a single array
may contain several numeric expressions within the parentheses, each denoting the maximum index
value in each “dimension” of the array. Thus, after execution of the DIM statements in lines 10 and
60 above, Q will be a one-dimensional array with a maximum index of 100, Z will be a two-
dimensional array with 5 rows and 2 columns, and X8 will be a three-dimensional array with a
maximum index of X in any of its three dimensions.
If a string or array is referenced in any statement without having been declared in a prior DIM
statement, it is automatically created, initialized, and dimensioned by BASIC, strings to a maximum
length of 10, and arrays to one dimension and maximum index of 10.
Whether “dimensioned” explicitly through a DIM statement or implicitly through first reference to
a previously non-existent variable, a string or array may not be “re-dimensioned” (declared in a
DIM statement executed later in time during the same RUN of a program). Any attempt to do so will
lead to a DIMENSION ERROR. (For the same reason, a DIM statement itself may not be repeated
during the execution of a program.)
ERROR MESSAGES:
MEMORY FULL ERROR
Not enough program/data area memory is available to hold one or more of the variables declared in
the DIM statement responsible for the error. See section IMPLEMENTATION NOTES for details
of memory allocation.
DIMENSION ERROR
An attempt was made to re-dimension a string or an array which already exists.
SEE ALSO:
Section USING STRINGS
Section USING ARRAYS
Page 28
NSB8
Rel. 5.10