However, you cannot carry out arithmetic on strings, even if the variable
contains only numbers. Thus, although:
example$="365"
is an acceptable string,
PRINT exampLe$+5
is meaningless to the computer. The contents of a string variable are treated as
a series of characters. You cannot reasonably carry out arithmetic on a house
number or a shoe size, and numbers stored as a string fall into the same
category.
Help that BBC BASIC can give you
BBC BASIC has many features to make programming simpler. You may
already have made a few mistakes when typing the example programs. If not,
type:
10 PRONT "This is a mistake."
and see what happens when you run the program. The most Iong-winded way
of correcting the error is to type the entire line again. Alternatively you can
edit or alter the line using the cursor control and keys at the right-hand
side of the main keyboard.
Press Arrow Up. As soon as you press the key, the cursor splits into two; the flashing
cursor is the copy cursor, which you can move around to copy text from
elsewhere on the screen; the white block is the write cursor, showing where
anything you type or copy will appear. The write cursor moves only after a
character has been typed or copied.
Move the copy cursor around until it is underneath the first character in the
erroneous line and then press once. The '1' is copied into the character
position indicated by the write cursor. Now press key four times more to
give:
10 PR
You do not want to copy the next character because it is incorrect. Type I at
the keyboard, and it will appear on your new line then use --> to move the copy
cursor until it is under the N in 10 PRONT . You can now copy the rest of the line
to give:
10 PRINT "This is a mistake. "
(If you make any errors when copying, you can use to remove the most
recent characters on your new line). When you have copied the last character,
press , and the corrected version of the line will replace the old one.
C 7