Post Reply 
A few Prime programming questions
09-29-2017, 03:41 PM (This post was last modified: 09-29-2017 04:12 PM by toshk.)
Post: #4
RE: A few Prime programming questions
Try this: Avoiding making copy of the original
Pass By Value: do not affect originals
In prime programing try AVars(''S1"):=S1; at the end of subroutine; exporting S1 outside for later use;
in subsequent subroutines WITHOUT using AVars("S1"):=S1'; S1'(modified). The Original S1 is left intact.
To effect changes in S1; subsequent subroutines USE AVars("S1"):=S1'; == The Original is modified with S1'.

Code:

new_prog(Sg);
Sg;
EXPORT new_programd()
BEGIN
Sg:={0,0,0,0,48};
print(Sg);
AVars("Sg"):=Sg;
new_prog(Sg)
END;

new_prog(Sg)
BEGIN
Sg:=2*Sg
print(Sg)
END;
After executing Programe:
Sg type on command line shows the original Sg;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: A few Prime programming questions - toshk - 09-29-2017 03:41 PM



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