# HP Forums

Full Version: Export Local Variables to use Globally
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
(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.
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.
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
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
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :