Prime app variables
|
12-14-2013, 02:36 AM
Post: #8
|
|||
|
|||
RE: Prime app variables
(12-13-2013 09:44 PM)Bob Frazee Wrote: I have a similar problem. Is DegF a variable which must keep its value for all programs? In other words, if IntroScreen changes DegF, then is InputScreen supposed to use this new value? Or keep its own DegF? If all these programs are supposed to use a single value for DegF, then it would make sense to use a global variable. Just don't export it (if you don't want anyone other than the programs you wrote to mess with the values). I have not had any issues passing parameters from one program to the next. The big question is whether the values passed should remain in the scope of the program to which they are passed vs. being kept for all programs to use. In order to properly call a subprogram, though, make sure to declare it before the program making the call. For example: Code:
In the example above, we use a, b, and c as dummy variables for both subprograms. They are local variables and are destroyed when each subprogram returns to the main routine. Notice that in MAIN() I have to do lots of book-keeping in order to avoid global variables. Moreover, my subprograms must return lists in order to return multiple values. With global variables, you just declare them at the top and every program within the source file can use those variables. Excluding EXPORT just prevents users from messing with them. Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Prime app variables - Jonathan Cameron - 12-13-2013, 03:33 PM
RE: Prime app variables - Han - 12-13-2013, 04:02 PM
RE: Prime app variables - Jonathan Cameron - 12-13-2013, 05:27 PM
RE: Prime app variables - Han - 12-13-2013, 05:42 PM
RE: Prime app variables - Jonathan Cameron - 12-13-2013, 06:17 PM
RE: Prime app variables - Han - 12-13-2013, 07:28 PM
RE: Prime app variables - Bob Frazee - 12-13-2013, 09:44 PM
RE: Prime app variables - Han - 12-14-2013 02:36 AM
RE: Prime app variables - Bob Frazee - 12-14-2013, 03:19 PM
RE: Prime app variables - Han - 12-14-2013, 09:19 PM
RE: Prime app variables - Bob Frazee - 12-15-2013, 04:02 AM
RE: Prime app variables - Han - 12-15-2013, 04:37 AM
RE: Prime app variables - Bob Frazee - 12-16-2013, 12:40 AM
RE: Prime app variables - cyrille de brébisson - 12-16-2013, 08:02 AM
|
User(s) browsing this thread: 1 Guest(s)