Commodore VIC-20 User Manual page 115

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

Advertisement

Chapter 3: Programming the VIC 20 Computer
101
data input from the keyboard and data output to the display. There are also
more complex input/ output statements that control data transfer between
the computer and peripheral devices such as cassette units, diskette units,
and printers. These more complex input/ output statements are described in
Chapter 8.
Since we have already encountered the PRINT statement, we will
discuss this statement first.
PRINT STATEMENT
You can use the word PRINT or a question mark to create a PRINT
statement.
Why use PRINT instead of DISPLAY or some abbreviation of the
word display? The answer is that in the early sixties, when the BASIC
programming language was being created, displays were very expensive and
generally unavailable on medium- or low-cost computers. The standard
computer terminal had a keyboard and a printer. Information was printed
where today it is displayed; hence the use of the word "print" to describe a
statement that causes a display.
The PRINT statement will display any data. Text must be enclosed in
quotes. For example, the following statement will display the single word
"TEXT":
113 PRmT "TEXT"
or
113 ?"TEXT"
To display a number, you place the number, or a variable name, after
PRINT. This may be illustrated as follows:
113 A:I.,.,10
213 ?5 . • A:I.
The statement at line 20 displays the number 5 and then the number 10 on
the same line.
You can display a mixture of text and numbers by listing the informa-
tion to be displayed after PRINT. Use commas to separate individual items.
The following PRINT statement displays the words "ONE", "TWO",
"THREE", "FOUR", and "FIVE", followed by the numeral for each
number:
113 ?"OHE",1,"TWO",2,"THREE",3,"FOUR",4,"FIVE",5

Advertisement

Table of Contents
loading

Table of Contents