Commodore VIC-20 User Manual page 103

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

Chapter 3: Programming the VIC 20 Computer
89
The two-dimension grocery list variable, GL$, would be dimensioned
as follows:
DIM OLS(3 .. 5)
A DIM statement can provide dimensions for any number of variables,
providing the statement fits within an 88-character line.
The number or numbers following a variable name in a DIM statement
is equal to the largest index value that can occur in that particular index
position. But remember, indexes begin at O. Therefore, MP$(5) dimensions
the variable MP$ to have six values, not five, since indexes 0, 1,2,3,4, and 5
will be allowed. GL$ (3,5), likewise, specifies a two-dimension variable with
24 entries, since the first dimension can have values 0,1,2, and 3, while the
second dimension can have values 0 through 5.
Once you have declared an array variable in a DIM statement, you
must subsequently reference the variable with the specified number of
subscripts; each subscript must have a value between 0 and the number
specified in the DIM statement.
If
any of these syntax rules are broken, you
will get a syntax error.
Branch Statements
Statements within a BASIC program normally execute in ascending
line number order. This execution sequence was explained earlier in this
chapter when we described line numbers. Branch statements change this
execution sequence.
GOTO STATEMENT
GOTO is the simplest branch statement.
It
allows you to specify the
statement that will be executed next. Consider the following example:
213 FI"4.37
30 OOTO ' . 1313
49
59
60
70
80
99
100
1113

Advertisement

Table of Contents
loading

Table of Contents