User Variables
|
03-05-2014, 08:44 PM
Post: #1
|
|||
|
|||
User Variables
Is there a line of code that will create a USER VARIABLE from within a program?
I have tried many variations. Thanks in advance for any help. Happy coding and may you see ' i No errors in the program ' with every compilation. |
|||
03-06-2014, 03:14 AM
(This post was last modified: 03-06-2014 03:22 AM by Han.)
Post: #2
|
|||
|
|||
RE: User Variables
(03-05-2014 08:44 PM)veeblefester Wrote: Is there a line of code that will create a USER VARIABLE from within a program? If you don't care that it is a CAS variable, then yes. Code:
Usage: MAKEVAR("var1") -- creates a CAS variable named var1 with an initial value of 0. Some caveats: even though a CAS variable is global, the program will not know about it until it gets created (i.e. it presumably does not exist during compilation). So you will need to be careful with your code -- but indirection would be fine. And now for a small digression... A CAS variable is much more versatile. You can even use it in the solver app. This means you can create your own equation library program that dynamically creates variables without actually having to predefine them, despite what many previous posts seem to suggest. And when you're done, you can purge them with the purge() command. Graph 3D | QPI | SolveSys |
|||
03-06-2014, 06:20 AM
Post: #3
|
|||
|
|||
RE: User Variables
Hello,
Quote:Is there a line of code that will create a USER VARIABLE from within a program? assuming that you are not talking CAS here... If you are trying to create a user variable akind to the ones created when you type something like abc:=5 on the command line, then the answer is no. If you are trying to create a user variable using a name provided by the user, no... You can create global variables in your program using EXPORT though. Cyrille |
|||
03-06-2014, 12:01 PM
Post: #4
|
|||
|
|||
RE: User Variables
Thanks Han. That will be useful in the future. It will not however, help me in this situation.
Thanks Cyrille. What a fundamental flaw in the operating system. Happy coding and may you see ' i No errors in the program ' with every compilation. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: