
Commands - 16
CLEAR
Statement
SYNTAX: CLEAR [string space]
PURPOSE: To set all numeric variables to zero, set all string variables to null, restore the data pointer, and
negate all DIM statements. You can optionally set the string space size.
REMARK S: If the optional parameter string space is specified, variables are cleared and the string space is made
equal to the number of bytes specified. 100 bytes is the default value on power– up. You can figure
the amount of string spa ce by adding up the number of ch aracter s you expect each string variable to
use and add the length of the longest string you will use. Then add 10% to that total. For example,
if you expect A$ to hold 75 characters and B$ to hold 45, you would need (45 + 75 + 75) x 1.1 =
215. For safety, you should round up to the next 100.
NOTE: Make sure you execute CLEA R befor e you execute any DIM statem ent.
Execute this statement if your program uses a large number of string variables for storage or
manipulation. You will get a <Out of string space> error if there is not enough space set
aside.
RELATED: none
EXAMPLE: The following clear s all variables and sets the string space to 100 bytes:
10 CLEAR
The following clear s all variables and reser ves 500 bytes of RAM for strings:
10 CLEAR 500
ERROR: < Data negative> – for string
< Out of memory> – if an attempt is made to clear more m emor y than is available
< Out of string space> -when not enough string space is reserved.
Commentaires sur ces manuels