Global variables are variables that are declared outside to be accessible by everyone in the application.
But if you search it in goole. The second query result is that global variables are bad. Why?
I think everything has its own pros and cons. And global variables' pros and cons depends on how it is being used. It also depends on how big or small your application is.
For smaller applications, global variables are not a problem. It helps your code to easily pass and access data from other classes and methods. You don't need to pass a variable every time you call a method or class.
Sharing data inside the application using global variables will also help you minimize local variable creation and lesser memory usage.
But for larger applications, using global variables are bad. It will make your application hard to maintain and read. Looking for global variables just to know how they were created or manipulated will take you some time. And in OOP, it destroys the idea of encapsulation.
But if you do understand what global variables are, then you just have to make your own decision in your implementation. Just code at your risk :D
Throughout the last year, I have worked part-time as a working student and also studied at the university. I was not the first and not the last one who has combined that during their studies, but the problem for me was, that at the end of the day I have felt absolutely exhausted mentally and physically. That caused problems with my health and motivation to continue working on my goals or anything. (yeah, “goals,” I wish I had something more specific at that time).