Non-local variable: Difference between revisions

Content deleted Content added
No edit summary
Ruud Koot (talk | contribs)
m copyedit
Line 1:
In [[programming language theory]], a '''non-local variable''' is a variable that is not defined in the local scope. While the term can refer to global variables, it is primarily used in the context of [[nested function|nested]] and [[anonymous function]]s where can some variables can be neither in neither the [[local scope|local]] nor the [[global scope]].
 
== Example ==
Line 13:
</source>
 
In thisthe next example the variable <code>c</code> is non-local in the anonymous function <code>\x -> x + c</code>:
<source lang=haskell>
outer = let c = 1 in map (\x -> x + c) [1, 2, 3, 4, 5]