Go to the first, previous, next, last section, table of contents.

Local Variables and Lexical Scope

Scheme is a block-structured language with nested scopes. You can declare local variables whose scope is a block of code, and blocks can have blocks inside them with their own local variables.

Scheme uses a lexical scope rule. (We can also say that Scheme is statically scoped, rather than dynamically scoped, like some old Lisps.) When you see a variable name in the code, you can tell what variable it refers just to by looking at the source code for the program. A program consists of possibly nested blocks of code, and the meaning of the name is determined by which variable binding constructs it's used inside.


Go to the first, previous, next, last section, table of contents.