[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:22 Jan 2004 23:54:20 -0000 
Subject:Re: Procedure Variables ??Help! 
From:not 
Volume-ID:1040122.01 

> with holds a variable i need in another procedure. 

This is what I think I remember:
 procedures don't 'hold variables'.
 
> How do i get that variable out without running the whole procedure??
> e.g.
> 
> define number();
> lvars input;
> readline -> input;
> input=>
> 66 -> price;              (i want to use this value below)
> enddefine; 
> 
In your example variable 'input' is local to the 'number' procedure.
This would be because the designer intended 'input' not to be 
known/accessible out side of the 'number' procedure.

Variables which are not local/private to a procedure, are said to
be global, and are accessible from anywhere [in the module ?].

> define useprice()
> I WANT TO USE THE VALUE 'PRICE' HERE!!!!!
> ...
> enddefine;
> 
In your code, the variable 'price' is not local/private to procedure
'number', [nor any procedure] so it may be read or written by the 
'useprice' procedure, or any where else.
------
Do graduated examples:
1. write to and read from global variables.
2. write to and read from global variables in sisde and outside of procedures.
3. make some variables local to some procedures: they can only be 
    'used' by their 'owners'.
    
== Chris Glur.