Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why are global variables poor style?

global poor style variables
0
Posted

Why are global variables poor style?

0

For now, we’re just telling you not to do them. Global variables become troublesome as your programs get larger. The problem with global variables is that you increase the chance that something will be changed in a way that you didn’t expect. By definition (since you didn’t expect it), this is hard to debug. If your subroutine does change a global variable, you should document this in the subroutine header comment.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123