Compare the two numbers of free bytes available. The second number
is two or three less than the first. Because simplicity is more
important to a beginning programmer than conservation of computer
memory, the program lines in this section will usually contain only one
statement per line. One exception will be a PRINT statement that
inserts a blank line between segments of the program. Type in the
new line below to see the effect:
110 PRINT:PRINT " C O N G R A T U L A T I O N S ! "
R U N
DIM AND INPUT: DIMENSIONING AND INPUTTING
STRING VARIABLES
The computer must be programmed to respond to a question. You can
use a PRINT command to ask a question and an INPUT command to
enter a response into the computer. However, when you give the
computer an answer, the computer must know where to put it. It
places it in a spot called a "variable" in RAM memory. If the answer
is composed of letters, numbers, or both, it is called a "string
variable." Your ATARI 65XE Computer needs to know how much
space you will need for an answer so that it can reserve space for it.
This process is called "dimensioning the string variable."
The DIM (dimensioning) command always accompanies the INPUT
command for string variables because DIM determines the expected
size of the answers. For variables, the size refers to the number of
characters, including blanks, that are needed. You have to tell the
computer the maximum number of spaces that the answer can
occupy.
Change the loop program to a program that asks a question and
expects an answer. There is no need to rewrite the program; just write
in the new lines—lines 10, 120, 130, and 140—as shown below.
(Typing in the new line 120 automatically erases the old line 120.)
10 DIM ANSWER$ (100)
110 P R I N T : P R I N T " C O N G R A T U L A T I O N S ! "
115 PRINT "YOU JUST WON THE LOTTERY. "
120 PRINT: PRINT "HOW DOES THAT M A K E YOU FEEL?"
130 INPUT ANSWER$
140 PRINT "I THOUGHT YOU WOULD SAY THAT. "
R U N
43
Содержание 65XE
Страница 1: ...ATARI 65XE PERSONAL COMPUTER OWNER S MANUAL TM...
Страница 3: ...ATARI 65XE PERSONAL COMPUTER TM...
Страница 6: ...Part 1 GettingStarted 1...
Страница 9: ...4...
Страница 23: ...18...
Страница 25: ...20...
Страница 32: ...Part 2 Programming withATARI BASIC 27...
Страница 33: ...28...
Страница 59: ...54...
Страница 69: ...64...
Страница 82: ...Part3 Appendices 77...
Страница 83: ...78...
Страница 97: ...92...
Страница 105: ...100...
Страница 125: ...120...
Страница 126: ...121 Index...
Страница 127: ...122...
Страница 134: ...ATARI 1987 Atari Corp All Rights Reserved Printed in Taiwan C072018 001 REV B K l 2 1987...
Страница 135: ......