Non-local variable: Difference between revisions

Content deleted Content added
Corrected "build" to "built" for grammatical correctness.
Line 2:
 
== Example ==
In the Python 3 example that follows there is a nested function <code>inner</code> defined in the scope of another function <code>outer</code>. The variable <code>x</code> is local to <code>outer</code>, but non-local to <code>inner</code> (nor is it global):
<source lang=python>
def outer():
Line 13:
</source>
 
In the nextHaskell example that follows 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]