PDA

View Full Version : Does global procedures contain local variables?


daval
05-27-2003, 10:20 AM
Hi,

Are variables defined within a global procedure also global? Or are they local to the scope of that procedure?

Thanks!

Buexe
05-27-2003, 10:46 AM
I am no variable guru, but after my understanding variables in a global proc are local, unless you define them as global variable so that you can use the output in other (global) procedures.
Hope this helps.
buexe

mark_wilkins
05-27-2003, 01:33 PM
Buexe is right.

If global procedures could not have local variables, every little variable you had to define in such a procedure would end up in the global variable namespace, and you'd have a huge mess!!

Not to mention that you could then never have two global procedures that differently defined a variable named $x, for example.

-- Mark

daval
05-27-2003, 05:21 PM
Thanks both for your answers.

It's good to know I don't have to use the global procedure only as a mean to call other local procedures containing the variables, thus preventing the huge mess in the global variable namespace. :)

CGTalk Moderation
01-15-2006, 06:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.