Closures/Value capture: Difference between revisions

added Julia example
(Add Logtalk implementation)
(added Julia example)
Line 542:
window.alert(funcs[3]()); // alerts "9"
</script></lang>
 
=={{header|Julia}}==
<lang julia>funcs = [ () -> i^2 for i = 1:10 ]</lang>
Output:
<pre>
julia> f[7]()
49
</pre>
 
=={{header|Logtalk}}==
Anonymous user