Post Reply 
Global Variable
03-20-2015, 06:53 PM
Post: #1
Global Variable
This is a simple test.
Try to fill this EXPORTED var3 with subroutine.
var1 and var2 have values, but var3 keeps on zero.
What is wrong on this?

Cheers,

Jan

TEST(); // Declaration of the subroutine
EXPORT var1,var2,var3; //Exported variable
EXPORT F1 ()
BEGIN
TEST(); // Call TEST and fill var3 with value
INPUT({var1,var2},{"var1=","va2="});
RETURN var1+var2;
END;

TEST()
BEGIN
var3:=12345.6789;
END;
Find all posts by this user
Quote this message in a reply
03-21-2015, 02:02 PM (This post was last modified: 03-21-2015 02:54 PM by DrD.)
Post: #2
RE: Global Variable
Changed the INPUT(..) line. This should work:

Code:

TEST(); // Declaration of the subroutine
EXPORT var1:=0,var2:=0,var3:=0; //Exported variable
EXPORT F1 ()
BEGIN
TEST(); // Call TEST and fill var3 with value
 
INPUT({{var1,[0],{25,50,0}},{var2,[0],{25,50,1}}});
  
RETURN var1+var2;
END;

TEST()
BEGIN
var3:=12345.6789;
END;
Find all posts by this user
Quote this message in a reply
03-21-2015, 08:23 PM
Post: #3
RE: Global Variable
(03-20-2015 06:53 PM)Powersoft Wrote:  This is a simple test.
Try to fill this EXPORTED var3 with subroutine.
var1 and var2 have values, but var3 keeps on zero.
What is wrong on this?

Cheers,

Jan

TEST(); // Declaration of the subroutine
EXPORT var1,var2,var3; //Exported variable
EXPORT F1 ()
BEGIN
TEST(); // Call TEST and fill var3 with value
INPUT({var1,var2},{"var1=","va2="});
RETURN var1+var2;
END;

TEST()
BEGIN
var3:=12345.6789;
END;
Your program works fine on my Prime as is. I get var3 value as assigned.
I have the same firmware and Model as you. Runs fine on both the emulator and
the real Prime.
Find all posts by this user
Quote this message in a reply
03-22-2015, 02:30 AM
Post: #4
RE: Global Variable
(03-20-2015 06:53 PM)Powersoft Wrote:  This is a simple test.
Try to fill this EXPORTED var3 with subroutine.
var1 and var2 have values, but var3 keeps on zero.
What is wrong on this?

Cheers,

Jan

TEST(); // Declaration of the subroutine
EXPORT var1,var2,var3; //Exported variable
EXPORT F1 ()
BEGIN
TEST(); // Call TEST and fill var3 with value
INPUT({var1,var2},{"var1=","va2="});
RETURN var1+var2;
END;

TEST()
BEGIN
var3:=12345.6789;
END;

Check and see if var3 isn't also an already existing variable (prior to creating your program).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 




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