Back to Developer Roadmap

Global Variables

src/data/question-groups/golang/content/global-variables.md

4.0300 B
Original Source

Global variables are declared outside functions and can be accessed by any other function from the project.

Although they facilitate data transfer between functions, overusing global variables is a known code smell that can lead to increased memory consumption and make your code less maintainable.