{{Distinguish|text=the programming language [[Clojure]]}}
{{Use dmy dates|date=August 2020}}
In [[programming language]]s, a '''closure''', also '''lexical closure''' or '''function closure''', is meanta thetechnique storagefor ofimplementing a[[lexically functionscoped]] (code)[[name andbinding]] thein valuesa oflanguage itswith parameters[[first-class when invokedfunction]]s. [[Operational semantics|Operationally]], a closure is a [[Record (computer science)|record]] storing a [[Function (computer science)|function]]{{efn|The function may be stored as a [[Reference (computer science)|reference]] to a function, such as a [[function pointer]].}} together with thean associationenvironment.<ref>Sussman and Steele. "Scheme: An interpreter for extended lambda calculus". "... a data structure containing a lambda expression, and an environment to be used when that lambda expression is applied to arguments." ([[s:Page:Scheme - An interpreter for extended lambda calculus.djvu/22|Wikisource]])</ref> The environment is a mapping associating each parameter[[free variable]] of the function of(variables athat are used locally, but defined in an enclosing scope) with the [[Value (computer science)|value]] or [[Reference (computer science)|reference]],calledto ''context''which the name was bound when the closure was created.{{efn|These names usually refer to values, mutable variables, or functions, but can also be other entities such as constants, types, classes, or labels.}} Unlike a plain function, a closure allows the function to access those ''captured variables'' through the closure's copies of their values or references, even when the function is invoked outside their scope.