enclosedvariable

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

A variable is a box that holds a value, and an enclosed variable is a box that only the code inside its own little area can open and use.

The function kept its count in an enclosed variable, so no other part of the program could change it.


OTHER MEANINGS

2. In programming, a variable that a nested function can access because it was declared in the surrounding function.

The inner function read the enclosed variable from the outer function's scope.

3. A variable that is protected inside a block or module and cannot be reached from outside.

Because it was an enclosed variable, the value stayed hidden from the rest of the code.

4. A variable captured by a closure and kept alive even after its original function finishes.

The callback remembered the enclosed variable long after the setup function had returned.