Transcript from the "Lexical Scope Elevator" Lesson
>> Kyle: One metaphor that I have used for years that works well for me and maybe will work well for you. This idea of scopes being nested within each other is similar to a building with a big tall elevator in it, okay? Imagine if you went into a building and you were looking for something but you didn't know where it was.
[00:00:17] You just knew it was somewhere in the building or probably somewhere in the building. You'd start on the first floor. You just do basically a linear search. Start on the first floor, look for it there. And if you don't find it, take the elevator to the next floor, look for it there.
[00:00:29] If you don't find it, do that again and again and again. And eventually you're gonna arrive at the top floor of the building. And you either find it or you don't, but there's nowhere else to go. So conceptually the first floor is our current scope where the reference is, and the top floor is the global scope.
>> Kyle: We'll come back to this metaphor a later time in the course. So just kinda keep that in your head if that works for you, this idea of going one floor up at a time. We don't immediately jump to the global scope, we just go one floor at a time.