PPL programming question; local variables
|
02-13-2014, 01:07 PM
(This post was last modified: 02-13-2014 01:08 PM by Han.)
Post: #8
|
|||
|
|||
RE: PPL programming question; local variables
(02-13-2014 11:47 AM)CR Haeger Wrote:(02-13-2014 07:01 AM)eried Wrote: I am not sure if Han recommends re-declaring local vars outside and as parameters with the same name. You can do what you tried to do using another names for the parameter. Those are all good recommendations. I just wanted to clarify a few points. The only global variable is the routine FINDANG() -- i.e. only exported variables are considered global. Defining local variables outside a procedural block doesn't make them global (in the same sense as the built-in variables A through Z) but simply gives them "file scope" from the point of declaration to the end to the file. They are similar to variables in C/C++ declared outside of functions. The point of ANG() was to merely demonstrate the use of local variables declared outside of a procedural block. There are only a few instances in which something like ANG() would be used. For example, the MAKEMAT() command has three parameters: an expression in terms of I and J, the number of rows, and the number of columns. The expression can be a simple IF THEN END statement. However, the structure of the language does not allow such a block as a parameter so that you must use a separate function for your expression. Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)