...

/

Scope and Shadowing

Scope and Shadowing

This lesson teaches you about the scope of a variable.

Scope of a variable

The scope of a variable refers to the visibility of a variable, or , which parts of a program can access that variable.

It all depends on where this variable is being declared. If it is declared inside any curly braces {}, i.e., a block of code, its scope is restricted within the braces, otherwise the scope is global.

Types of Variables

...