Always Prefer to Use Local Variables

You should always prefer to use Local variables. Local variables reside within functions and subs. They have local scope and limited lifetime. These variables are compiled into numeric references and put in a table. Local variable references can be resolved at compile time.
Global variables, on the other hand are resolved at run time. Due to this, local variable access is many times faster than global variable access. Also, undimensioned global variables are very slow. Whenever an undimensioned global variable is used for the first time, the entire object model is searched for an object with that named property before a new one is created.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: