beautypg.com

Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual

Page 48

background image

RPBASIC-52 PROGRAMMING GUIDE

2-29

DIM

Syntax:

D I M name(size)[,name(size)...]
Where: name = A n y v a li d v a ri a bl e n a m e

size = 1 to 255 elem ents

Function:

Reserves storage for single-dimension array.

Mode:

Comm and, run

Use:

D I M F L O W ( 20 0 ) : R E M d im e n s io n s a 2 0 0 e l em e n t ar r ay c a ll e d F L O W

Cards:

All

D E S C R IP T I ON

The maxim um num ber of array elements is 255, accessed as name(0) through name(254). CLEAR, NEW , or
RU N com man ds de-a llocat e all arr ay stor age. T he def ault siz e of und eclare d array s 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 dimen sioned arrays.

RELATED

S T R I N G , C L E A R

E R R O R

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