•  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-FileLOCAL var1[,var2,var3,...]

var1, var2, var3: avar, svar

It is possible using the command LOCAL to limit the area of application of
variables. The variables specified after LOCAL are only valid in the procedure
in which the LOCAL command is used. Also any variables in all subroutines
called by this procedure will be local. Thus it is possible for variables
specified after LOCAL to have the same name as variables in the main program,
i.e. global variables. These global variables cannot be addressed then in the
subroutine but are available after leaving the procedure and remain unchanged.

Note: The parameter list given to a procedure or function are always local.

Example:

    x=2
    GOSUB test
    PRINT x,y
    '
    PROCEDURE test
      LOCAL x,y
      x=3
      y=4
    RETURN

--> The numbers 2 and 0 are displayed on the screen.

Memo: For compiler optimizations see section 'Local and Global Variables'.

      The original manual doesn't state it, but all local variables are
      initialized to 0 or "".