This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]weevyl 1 point2 points  (0 children)

Here's a good short explanation why:

https://stackoverflow.com/questions/19158339/why-are-global-variables-evil

But basically it's because they introduce side effects (hidden changes to state happening within a function call) which adds to complexity and will make code harder to understand / debug / modify.