•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileCLEAR
CLR x[,y,...]
ERASE z1()[,x2(),...]

x, y: svar or avar
z1, x2: name of arbitrary array

With CLEAR all variables and arrays are emptied. The instruction cannot be used
within FOR-NEXT loops or subroutines. When a program is RUN it is implemented
automatically, otherwise it is really only applicable for dealing with serious
faults before using RESUME proc appropriately. All open channels will be closed
as well.

The instruction CLR sets all variables specified in the list following it to 0
or "" depending on it's type. Arrays cannot be used with CLR, see ARRAYFILL.

ERASE deletes complete arrays, which can then be redimensioned if required. In
contrast to Version 2, several arrays can be deleted at once, for example ERASE
x(),y().

Example:

    x=2
    y=3
    CLEAR
    PRINT x,y
    '
    x=2
    y=3
    CLR x
    PRINT x,y
    '
    DIM x(10)
    PRINT FRE(0)
    ERASE x()
    PRINT FRE(0)

--> The above program prints three zeros and a '3' on the screen. After that
    the amount of free memory is displayed both before and after the erasure
    of x(), showing that the memory occupied by the array is released by
    ERASE.

Memo: The command ERASE should be avoided as it can lead to many hard to
      find errors.

      CLEAR closes all open channels, as if 'CLOSE' was executed.
      CLEAR also resets the _DATA pointer back to the first DATA statement.
      This happens in the editor and compiled programs.
      This information was missing from the manual.

      Also clears the event flags for all 'ON x GOSUB' commands.
      This only happens in the editor.

      CLEAR inside a FOR-NEXT loop or subroutine is fatal.
      ERROR code #40 does not actually work.