Sobes.tech
Junior — Senior

Definition of the result of a competitive write into a map cell

livecode

Task condition

You need to understand what value will be in the display cell after several goroutines simultaneously try to write different numbers to it.

m := make(map[int]int, 1)
go func() { m[1] = 2 }()
go func() { m[1] = 7 }()
go func() { m[1] = 10 }()

time.Sleep(100 * time.Millisecond)
fmt.Println("m[1] =", m[1])