Post Reply 
Program local variables issue
02-11-2020, 09:38 AM (This post was last modified: 02-11-2020 09:59 AM by Gene222.)
Post: #10
RE: Program local variables issue
(02-11-2020 06:25 AM)Wes Loewer Wrote:  Here is a counterexample. Create these two program in separate source files.
Code:
LOCAL var1:=1;

EXPORT PROG1()
BEGIN
 RETURN var1;
END;
and
Code:
EXPORT PROG2()
BEGIN
 PROG1.var1:=PROG1.var1+1;
 RETURN PROG1.var1; 
END;

Run PROG1, then PROG2 and you see that var1 has changed. If you run PROG1 again, it confirms that var1 really has changed. Likewise, you can alter PROG1.var1 from the Home screen as well.

You are correct. One can access a local variable that was created inside a program block by using its fully qualified name. Still, I found Han's explanation of program variables to be better than the explanation in the user manual. There was another exception about variables created in an app view functions, but I can't remember it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Program local variables issue - DrDarius - 02-10-2020, 02:25 AM
RE: Program local variables issue - Gene222 - 02-11-2020 09:38 AM



User(s) browsing this thread: 4 Guest(s)