Line 20 prints characters using the usual text coordinates. The VDU 5 in line
30 joins the text and graphics cursors. In line 50 MOVE is used to position the
text, which can now only be printed at graphics coordinates. Finally, the VDU 4
command returns the text cursor to normal so that PRINT TAB is usable
again.
Input
Earlier you saw that you can type in information while a program is running if
the program contains an INPUT statement:
10 MODE 135
280PRINT "How old are you" ;
360INPUT age
40 PRINT "So you're ";age;" years old."
50 PRINT "You don't look it !"
The INPUT statement in line 30 causes the computer to print a question mark,
and then wait for information to be typed at the keyboard. The computer
expects a number to be typed, because age is a numeric variable. Once
is pressed, the computer stores the value typed in the variable age. If you type
text rather than a number, the computer assumes the number is zero.
If you want to input text, you must use a string variable in the INPUT
statement:
10 MODE 135
20 PRINT "What is your name" ;
30 INPUT name$
40 PRINT "Hello " ;name$;'' and how are you?"
You can use a single INPUT statement to ask for several inputs:
10 MODE 135
20 PRINT "What is your name and age ";
30 INPUT name$, age
40 PRINT "Hello ";name$;". So you are " ;age;" years old. "
In this case the computer will expect two inputs, one a string and one a numeric
variable. They can either be separated by commas, or both can be followed by
The PRINT statement just before the INPUT is there to give a message to
remind you what you should type. This message can be included within the
INPUT statement:
10 MODE 135
20 INPUT "What is your name ";name$
30 PRINT "Hello " ;name$; ". Pleased to meet you."
C 27