What is lexical scope?

I understand them through examples. 🙂 First, lexical scope (also called static scope), in C-like syntax: Every inner level can access its outer levels. There is another way, called dynamic scope used by the first implementation of Lisp, again in a C-like syntax: Here fun can either access x in dummy1 or dummy2, or any x in any function that call fun with x declared in it. will print 5, will print 10. The … Read more