Global+Variable

A global variable is a variable that is accessible in every scope. They are used mainly to pass information between sections of code that don't share a caller/callee.

Global variables are considered bad becuase of their non-locality, a global variable can be modified by anyone from anywhere, and the program is dependent on it the way it is, so if it is changed the program may not work. By using global variables makes the program harder to read and understand. Non-locality, source code is easiest to understand when the scope of its individual elements are limited. Global variables can be read or modified by any part of the program, making it difficult to remember or reason about every possible use.

In Visual Basic

Global variables are created with a public statement in the general declaration section of a from or core module. The value of the variable is availiable to any procedure, in any form or core module. Memory given to a global variable is not released until the program shuts down.

It is easier to make every variable global but sometimes you cannot waste memory so by using global variables you could be using more memory than you actually need.