Closures/Value capture: Difference between revisions

Content added Content deleted
(Add Logtalk implementation)
(added Julia example)
Line 542: Line 542:
window.alert(funcs[3]()); // alerts "9"
window.alert(funcs[3]()); // alerts "9"
</script></lang>
</script></lang>

=={{header|Julia}}==
<lang julia>funcs = [ () -> i^2 for i = 1:10 ]</lang>
Output:
<pre>
julia> f[7]()
49
</pre>


=={{header|Logtalk}}==
=={{header|Logtalk}}==