enclosing variable

noun
UK /ɪnˈkləʊzɪŋ ˈveəriəbl/
US /ɪnˈkloʊzɪŋ ˈveriəbl/

A variable from an outer function that an inner function can use.

In the code, the inner function reads the enclosing variable from the outer function.


OTHER MEANINGS

2. A variable declared in a surrounding block that is visible to code inside that block.

The loop body can see the enclosing variable declared just above it.

3. In programming languages, a non-local variable referenced by a nested function.

The compiler stores the enclosing variable in the closure's environment.

4. A variable from an outer scope that a lambda expression captures.

The lambda captures the enclosing variable by reference.