HP Forums
Export Local Variables to use Globally - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Export Local Variables to use Globally (/thread-10841.html)



Export Local Variables to use Globally - mathnovice - 06-01-2018 01:51 PM

I have borrow a Kinematics solve program and have been editing it. I have made local variables and they are common to the 5 programs that I have made (due to only having the ability to input 10 equations per program). I have made my local variables common to all programs e.g gravity = g, change in time = (delta)t for all. When I solve for some local variable in Kinematics g program I want that same variable to to have the same value when I switch to Kinematics PROJ program. Is the possible?
[attachment=5982]
[attachment=5983]
[attachment=5984]


RE: Export Local Variables to use Globally - toml_12953 - 06-01-2018 02:07 PM

(06-01-2018 01:51 PM)mathnovice Wrote:  I have borrow a Kinematics solve program and have been editing it. I have made local variables and they are common to the 5 programs that I have made (due to only having the ability to input 10 equations per program). I have made my local variables common to all programs e.g gravity = g, change in time = (delta)t for all. When I solve for some local variable in Kinematics g program I want that same variable to to have the same value when I switch to Kinematics PROJ program. Is the possible?

I believe if you use the uppercase variables A - Z and don't declare them local, they're available to all programs and apps.


RE: Export Local Variables to use Globally - mathnovice - 06-01-2018 02:18 PM

yes this is true. Kinematics are already a mess with all the variables that they use: y final, y initial, delta x, delta t....and many more. As an example on the Y axis: I need "Y final, Y initial, (Delta)Y. Sure I could use Y, F, I, but I also need final/initial/delta for X axis, X is easy enough but what to use for F and I, using A & B would be too confusing (x final = A and X intial = B, that would be tough to keep track of.) That is why I made local variables. I tried that route first and ran into confusion since to the best of my knowledge only uppercase letters are global from HP.


RE: Export Local Variables to use Globally - BERNARD MICHAUD - 06-03-2018 01:21 AM

Use the command [/color]EXPORT yfinal,gravity,deltaT;. Maximum 8 vars per line at the begining of the program. These variables then become Global and can be used in any part of the program or even other programs.

BM


RE: Export Local Variables to use Globally - cyrille de brébisson - 06-04-2018 04:56 AM

Hello,

Program variables declared OUTSIDE of a function are global (meaning that they exist from the moment the file is compiled and keep their value until the program is recompiled or erased).

Such global variables, if they are NOT in an app program, AND if they are declared with "EXPORT" will be accessible from anywhere just by typing their name.

Cyrille