The Art of How To Program A Computer — Concurrently
Primanata Ardhitama

variable inside go anonymous function seems take last loop i value because its outside of it context.

Go lang code should be like this to get correct value:

package main

import (

func main() {
 for i := 0; i < 10; i++ {
 go func(j int) {
 time.Sleep(1 * time.Second)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.