Thanks for reply, but I want to know the underlying reason about it, I 
think the reason is in how the runtime functions works.
And I'm sorry about the empty picture, when I write this, I just copy the 
screenshot in this, the code is https://play.golang.org/p/fSPpo4_-k57    
The empty picture is the code and it's different results.

package main

import (
"fmt"
)

func main() {
var m = map[string]int{
"A": 21,
"B": 22,
"C": 23,
}

counter := 0
for k, v := range m {
if counter == 0 {
m["D"] = 20
}
counter++
fmt.Println(k, v)
}
fmt.Println(counter)
}

在2020年11月11日星期三 UTC+8 上午1:23:46<jake...@gmail.com> 写道:

> I'm not sure what strange way you decided to show your code, but in my 
> Firefox browser all I see is two empty boxes. Please use fixed width *plain 
> text* for all code in this group. Thanks. 
>
> On Tuesday, November 10, 2020 at 9:12:54 AM UTC-5 Kilos wrote:
>
>> when I run the same code like this 
>> https://play.golang.org/p/fSPpo4_-k57,most of the time it print A,B,C 
>> and D,but sometimes it just print A,B and C,why ???
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20f07979-30ad-41d7-b262-fc08198be6a0n%40googlegroups.com.

Reply via email to