Исходники и презентации
This commit is contained in:
25
lessons/maps/update_during_iteration/main.go
Normal file
25
lessons/maps/update_during_iteration/main.go
Normal file
@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Need to show solution with maps.Clone
|
||||
|
||||
func main() {
|
||||
data := map[int]struct{}{
|
||||
0: {},
|
||||
1: {},
|
||||
2: {},
|
||||
}
|
||||
|
||||
for key := range data {
|
||||
data[10+key] = struct{}{}
|
||||
}
|
||||
|
||||
for key := range data {
|
||||
fmt.Print(key)
|
||||
fmt.Print(" ")
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println(data)
|
||||
}
|
||||
Reference in New Issue
Block a user