Closures/Value capture: Difference between revisions

(Simpler first D version)
Line 370:
window.alert(funcs[3]()); // alerts "9"
</script></lang>
 
=={{header|Mathematica}}==
<lang Mathematica>a[i_] := Function[z, z*z][i]
 
a[2]
->4
 
a[5]
->25
 
a[2]
->4</lang>
 
 
=={{header|Objective-C}}==