
RPBASIC-52 PROGRAMMING GUIDE
2-29
DIM
Syntax: DIM name(size)[,name(size)...]
Where: name = Any valid variable name
size = 1 to 255 elem ents
Function: Reserves storage for single-dimension array.
Mode: Command, run
Use: DIM FLOW(200) : REM dimensions a 200 element array called FLOW
Cards: All
DESCRIPTION
The maxim um number of array elements is 255, accessed as name(0) through name(254). CLEAR, NEW , or
RUN com mands de-a llocat e all array storage. T he default size of und eclared arrays is 10 (i.e . 11 elem ents).
An array cannot be redimensioned after it has been dimensioned. Memory required for an array is ((integer
size + 1) * 6). Array A(99) requires 600 bytes of memory. Available memory typically limits the size and
number of dimensioned arrays.
RELATED
STRING, CLEAR
ERROR
ARRAY SIZE When size >255
EXAMPLE
10 DIM FLOW(200), LEVEL(200)
20 ONTICK 1,1000
30 IF PTR < 200 THEN 30
40 ONTICK 0,1000
50 FOR N=0 TO 199
60 PRINT FLOW(N),LEVEL(N)
70 NEXT
80 END
1000 FLOW(PTR)=AIN(0)
1010 LEVEL(PTR)=AIN(1)
1020 PTR=PTR+1
1030 RETI
Komentáře k této Příručce