Local and Global Variables.

The main difference between these two types of variable is the scope in which they operate, this is called their domain.

  • Local variables – are only used within their own procedure. Changing them has no effect on the rest of the program.
  • Global variables – can be seen and changed from any part of the program. This means that they are quite resource intensive. If you finish working with the variable it will continue to take up space until the program exits.

Rule of thumb, Global variables are bad, okay!

More details.