Commodore VIC-20 User Manual page 97

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

Advertisement

Here's a short program that shows one way to use variables:
10A$ = "VIC20"
20 PRINT"HELLO,"A$
RUN
The VIC will display HELLO, VIC 20. Why? Because in Line 10
we told the VIC that the variable A$ is the same as "VIC 20".
Now try this:
10A = 2
20B = 3
30C = 4
40PRINT A'B'C
In this example, A'B'C is the same as 2'3*4 because we
"stored" the numbers 2, 3, and 4 in the variables A, B, and C.
Here's a final example that uses two kinds of variables with
INPUT statements. The INPUT statement allows the person
running the program to define what the variable will stand for
like this:
10PRINT"WHAT WORD DO YOU WANT X$ TO STAND FOR":
INPUT X$
20PRINT"WHAT NUMBER DO YOU WANT X TO STAND FOR":
INPUT X
30PR!NT"NOW XS STANDS FOR" X$
40PRINT"AND X STANDS FOR" X
RUN
87

Advertisement

Table of Contents
loading

Table of Contents