Reset the computer to clear the memory. (CTRL] [SHIFT] and [ESC] keys). If you had wanted an
input made up of any characters (letters or letters and numbers), the dollar sign $ must be used at
the end of the variable.
Type in the following program: (Note that in line 20 you must put a space after the o in hello and
before the m in my).
10 input "what is your name"; name$ [ENTER]
20 print "hello "; name$" my name is Arnold" [ENTER]
run [ENTER]
On the screen you will see:
what is your name?
Type in your name then [ENTER]
If your name was Fred you will see on the screen:
hello Fred my name is Arnold
(As a point of interest, Arnold was the codename for the AMSTRAD CPC464 during its
development.)
Although we used name$ in the above for the name string variable, we could have just as easily used
a letter, for example a$. Now we will combine the above 2 examples into one program.
Reset the computer by pressing [CTRL] [SHIFT] and [ESC]. Type in the following:
5 cls [ENTER]
10 input "what is your name"; a$ [ENTER]
20 input "what is your age"; b [ENTER]
30 print "I must must say ";a$ " you dont look";
b"years old" [ENTER]
run [ENTER]
In this program we have used 2 variables, a$ for the name and b for the age.
On the screen you will see:
what is your name?
Now type in your name (e.g. Fred) then [ENTER]. You will then be asked:
what is your age?
Now type in your age (e.g.18, then [ENTER]. If your name were Fred and your age 18, on the screen
you will see:
I must say Fred you dont look 18 years