RosettaCodeData/Task/Closures-Value-capture/Phix/closures-value-capture-2.phix
2017-09-25 22:28:19 +02:00

13 lines
272 B
Text

function square(integer tid)
integer i = getd("i",tid) -- (setd valid here too)
return i*i
end function
sequence tids = {}
for i=1 to 10 do
--for i=11 to 20 do
tids &= new_dict({{"i",i}})
end for
for i=1 to 10 do
printf(1," %d",square(tids[i]))
end for