Answer: What is lexical scope?

Towry - Nov 6 '20 - - Dev Community

I understand them through examples. :)

First, lexical scope (also called static scope), in C-like syntax:

void fun()
{
    int x = 5;

    void fun2()
    {
        printf("%d", x);
    }
}

Every inner level can access its outer levels.

There is another way, called dynamic scope used by the first…

. . . . . . . . . . . .