ScopeReading Only
This lesson is a little short, but I have some visuals and videos to help!
Scope refers to the lifecycle and visibility of a variable, where it can be accessed, and when it exists. A variable is “in scope” when it’s usable within the block of code where it was declared, and it “goes out of scope” once that block ends. These blocks are defined by { }
, and every time you open a new set of braces, you create a new scope.
I made a video about it here: https://www.youtube.com/watch?v=cadnE-V2GB8&list=LL
And you can practice some more here: https://www.campapex.org/practice/scope