A scope nested inside another scope can “see” variables in all the outer scopes in which it is contained.
A new local scope is introduced by most code blocks…If such a block is syntactically nested inside of another local scope, the scope it creates is nested inside of all the local scopes that it appears within, which are all ultimately nested inside of the global scope of the module in which the code is evaluated. Variables in outer scopes are visible from any scope they contain — meaning that they can be read and written in inner scopes…