it’s common programming advice that global variables are bad
They're not. This is what we tell beginners because one needs to be careful when maintaining a global state and beginners often do it horribly.
But having a global state is sometimes the right solution.
Pro tip: if you ever find yourself saying "x programming practice is always wrong" you're probably wrong.

all 6 comments