You can change the amount
of
space allocated for strings with the CLEAR statement.
For example, type:
CLEAR
1000
: PRINT
FRE("")
CEB.I:EID
and you should see:
1000
which indicates that 1000 bytes have now been allocated for string space. This
allocation, however, reduces the amount of available memory for your program.
You
can verify this by typing:
PRINT
FRE(0)
~
The number displayed should be less than the previous amount available by (1000
~
256) = 744 bytes.
Experiment
#6
Printing Quotation Marks
Suppose you would like to display quotation marks. This presents a problem because
the quotation marks are recognized by BASIC
as
the delimiters
of
text strings. To see
this,
try to display the following phrase, including the quotation marks using the
conventional PRINT statement:
PRINT ""GO
WEST
YOUNG
MAN""
<OOEID
The unusual result:
o
is
due
to the fact that the first pair
of
quotation marks define a string consisting
of
a
single space.
The phrase
"GO
WEST YOUNG
MAN"
is
interpreted
as
a numeric variable
(initialized to zero). The second pair
of
quotation marks also print a single space after
the zero. This example should make it apparent that you cannot print quotation marks
in this way. However, it is possible to print them using a special string function.
Type:
PR
I
NT
CHR$
(34)
"GO
WEST
YOUNG
MAN"
CHR$
(34)
(ENTER)
to display:
"GO
WEST
YOUNG
MAN"
The function CHR$(34) returns the quotation mark character
as
a string constant. The
argument value 34
is
the ASCII character code for the quotation mark. Therefore, to
display a quotation mark, use CHR$(34) in the PRINT statement.
Confirm this by typing:
PRINT
CHR$(34)
~
116