Action
Erases a variable so memory will be released.
Syntax
ERASE var
Remarks
var The name of the variable to erase.
The variable must be dimensioned before you can erase it.
When you need temporary
variables you can erase them after you used them. This way your program
uses less memory.
You can only ERASE
the last dimensioned variables. So when you DIM 2 variables for local
purposes, you must ERASE these variables. The order in which you ERASE
them doesn't matter.
For
example :
Dim a1 as byte , a2 as byte , a3 as byte , a4 as byte
'use the vars
ERASE a3 : ERASE a4 'erase the last 2 vars because they were temp vars
Dim a5 as Byte 'Dim new var
Now you can't erase the vars a1 and a2 anymore !
Note that ERASED variables
don't show up in the report file nor in the simulator.
Example
DIM A As Byte 'DIM
variable
A = 255 'assign value
Print A 'PRINT variable
ERASE A 'ERASE
DIM A AS INTEGER
'DIM again but now as INT
PRINT
A 'PRINT again
REM Note that A uses the same space a the previous
ERASED var A so
REM it still holds the value of the previous assigned variable
|