global
keyword; prefer dependency injectionglobal
keyword; prefer dependency injectionThe global
keyword allows access to global variables within the local scope of a function or method. However, using global variables can make code harder to understand, test, and maintain. Prefer dependency injection, where dependencies are explicitly passed into functions or classes, making the code more modular, reusable, and easier to manage.