Scope refers to where a variable can be accessed in a program. While some variables can be accessed from anywhere within a program, other variables may only be available in a specific context. Scope depends entirely on where a variable is declared.

You can think of scope like the view of the night sky from your window. Everyone who lives on the planet Earth is in the global scope of the stars. The stars are accessible globally. Meanwhile, if you live in a city, you may see the city skyline or the river. The skyline and river are only accessible locally in your city, but you can still see the stars that are available globally.

We'll learn more about scope in this lesson through the use of variables.


Once you feel like you have a high-level understanding of scope, proceed to the next exercise.

Report a Bug
If you see a bug or any other issue with this page, please report it here.