# global variable

CEFR C1 · Compound

Source: https://englishreference.com/word/global-variable
Updated: 2026-07-22

## Definition

a piece of information in a computer program that any part of the code can see and change. You use it when you want data to be available everywhere in your project.

For teachers: a variable declared outside of any specific function or block, making it accessible throughout the entire program's scope. Often discouraged in modern software engineering due to the risk of unintended side effects across different modules.

## Examples

- The programmer used a global variable to store the user's name.
- While using a global variable is convenient for small scripts, it can make debugging large applications very difficult.
- The architectural review highlighted that over-reliance on a global variable for state management had introduced several race conditions that were nearly impossible to replicate in a testing environment.

## Usage notes

- Commonly used in the plural; often contrasted with 'local variable'.

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
