Question: what is the difference between static scoping and dynamic scoping explain with an example?
Answer: Static scoping is also called lexical scoping. In this scoping a variable always refers to its top level environment. ... In contrast, dynamic scope requires the programmer to anticipate all possible dynamic contexts.