>>>BTW, it is not necessary to define a global variable as PUBLIC, a PRIVATE defined in the highest program layer will be global to the application. The only thing PUBLIC does is make the variable live beyond the end of the program that defines it.
>>
>>Thank you for clarifying. Are you saying that PUBLIC variables stay in the memory of the PC even after you close the application?
>
>Function A calls Function B, which in turn calls Function C. Now, you need to use a variable in Function B.
>
>
If you don't declare it, it may overwrite a variable from Function A. Otherwise, it will work just like a private variable, i.e., it will be accesible in Function C.
>If you declare it as Local, it is only accesible in Function B. In Function C, it is hidden.
>If you declare it as Private, it will hide the same variable from Function A (if there is one), but otherwise work like an undeclared variable: it will be accesible from Function C.
Slight correction: local and public create variables, which can be accessed directly without any previous assignment in the subfunction. Private only hides any previously delclared var, but you must assign a value first before accessing it down the line again.
>If you declare it as Public, it will persist in memory even after Function B finishes. This includes Function A, but also the Command Window after Function A closes.
>
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only