Besides usual variables, in smart BASIC you can also use arrays. Array is a variable which can hold multiple values. Each value is addressed by using index. For example, command
Code: Select all
DIM M (100)
Code: Select all
N = 12 'number of array values
DIM X (N) 'create array
'fill array
FOR K = 0 TO N - 1
X (K) = K ^ 2
NEXT K
'read array
FOR K = 0 TO N - 1
PRINT K; X (K)
NEXT K
Code: Select all
DIM X (30) 'one-dimensional array
DIM Y (20,30) 'two-dimensional array
DIM Z (50,50,50) 'three-dimensional array
Code: Select all
OPTION BASE 1
DIM X (12) 'create array
'fill array
FOR K = 1 TO 12
X (K) = K ^ 2
NEXT K
'read array
FOR K = 1 TO 12
PRINT K; X (K)
NEXT K
Draw maze on the screen.