4 ms·
This seems reasonable. As others state, this is hardly an issue specific to Go. In CoffeeScript (which I think solves this nicely), it looks something like
by arh68 4y ago
This seems reasonable. As others state, this is hardly an issue specific to Go.
In CoffeeScript (which I think solves this nicely), it looks something like
for i in [0...3] # 3 3 3
setTimeout (() -> console.log "#{i}"), 100
for i in [0...3] # 0 1 2
setTimeout (do (i) -> () -> console.log "#{i}"), 100
for i in [0...3] # 0 1 2
do (i) ->
setTimeout (() -> console.log "#{i}"), 100