block-localvariable

noun
UK /blɒk ˈləʊkəl ˈveəriəbl/
US /blɑk ˈloʊkəl ˈveriəbl/

A variable that only works inside one small part of a computer program.

The counter is a block-local variable, so it resets every time the loop runs.


OTHER MEANINGS

2. A name that exists only within a pair of curly braces in code.

Declaring x as a block-local variable keeps it hidden from the rest of the function.

3. A temporary storage spot created when a code block starts and removed when it ends.

Each iteration creates a fresh block-local variable for the loop body.

4. A programming term for a value that cannot be seen outside its enclosing block.

Because it is block-local, the variable throws an error if you use it after the block closes.