Closures/Value capture: Difference between revisions

m
m (→‎{{header|Sidef}}: updated code)
Line 1,700:
=={{header|Sidef}}==
<lang ruby>var f = (
0 10..^ 9 -> mapof {|i| func(j){i * j} }
);
 
0 9..^ 8 -> eachtimes { |j|
say f[j](j);
}</lang>
{{out}}
Line 1,720:
 
Starting from i=1:
<lang ruby>var f = (1..10).ofmap { |i|
func(j){i * j}
}
 
for j (1..9) {
9.times { |j|
say f[j-1](j);
}</lang>
{{out}}
2,747

edits