in reply to Re: NEVER do this. Ever. Not even once.
in thread Variable Scope
As for global variables, they're hard to track down, they can have unfortunate side effects, they can make your code difficult to follow, they break encapsulation, they reduce reusability, and they can lead to severe contortions when you add new things.
That's not to say that they're forbidden. bikeNomad points out a place where it's absolutely necessary. It's even useful.
It's just that, in general, the places where you really need to use global variables are few and far between. Appropriately scoped lexicals exist for a reason.
|
|---|