Hey guys, another dummy question here:
for i in [0..4] Utils.delay i, -> print i # Output: 5 5 5 5 5
Why not "0 1 2 3 4"?
Make sure print is indented one more level than Utils.delay
It looks like i is captured by reference, so as it updates the closure accesses the latest value, and since the closure is invoked after a delay, then its after i has iterated beyond the range of 0 to 4. Likely you'll want a line between for and delay that captures the value of i into a different const, and use that const in the closure.