๐Ÿ“˜

Scope

Where in a program a variable can be seen and used.

๐Ÿ˜Š In simple words

Where in a program a variable can be seen and used.

๐ŸŽ“ Technical definition

The region of a program in which a name is visible; variables created inside a function are local to it.

Pseudocode example
1FUNCTION F()2    SET LOCAL_X = 1   // only exists inside F3END FUNCTION

๐ŸŽ Real-world analogy

What happens in your bedroom stays in your bedroom.

๐Ÿ”— Related concepts

โ† Whole glossary