>So how long does a PRIVATE variable exist if it remains in existance after a method or procedure has completed. And how is that different from a PUBLIC variable?
>
>Where would you use a PRIVATE variable?
>
>Thanks for your help.
Rixon,
The scope of variables are PUBLIC, PRIVATE, and LOCAL. Variables are PRIVATE by default.
Scope Created Destroyed Visibility
LOCAL When declared When the creating routine ends The creating
routine only
PRIVATE When initialized When creating routine ends The creating
routine and any
code called from
it.
PUBLIC When declared When it is released The creating and
all others both
below it and
above it in the
calling stack.
If a variable is created using Var =
it will be private unless the var already exists, in that case it will be whatever the existing var is, PRIVATE or PUBLIC (LOCALs from higher routines are hidden from lower routines). A very good practise is to try and use only LOCAL vars as they promote good encapsulation of code and minimize the external coupling of routines.