Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set variable=nothing 3

Status
Not open for further replies.

LawnBoy

MIS
Mar 12, 2003
2,881
I see this a lot in the examples provided in this forum. Why is it necessary? When the script exits, do the declared variables somehow persist?

Please enlighten this ignorant newbie...


"We must fall back upon the old axiom that when all other contingencies fail, whatever remains, however improbable, must be the truth." - Sherlock Holmes

 
This is mostly good habbit when playing with OLE automation objects to avoid ghost instances.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
And it is mostly dogma. A object going out of scope has exactly the same effect as setting the object to nothing.
 
I agree that there is not nearly as much need for it as there once was. I don't do it as much as I used to. Having said that, it adds no overhead to the script (except more lines for the coder to read) and it is a good habit if you also code in other languages that don't do garbage collection as seamlessly.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top