Skip to content

Commit c00ad36

Browse files
author
刘建秋
committed
struct{} update
1 parent f1f4114 commit c00ad36

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

EN/struct/struct.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,18 @@ addresses are equal
4747
var set map[string]struct{}
4848
// Initialize the set
4949
set = make(map[string]struct{})
50+
5051
// Add some values to the set:
5152
set["one"] = struct{}{}
5253
set["two"] = struct{}{}
54+
5355
// Check if a value is in the map:
54-
A kind of , ok := set["one"]
56+
5557
//output true
56-
fmt.Println ("Is one in the map?", ok)
57-
A kind of , ok = set["three"]
58+
_, ok := set["one"]
59+
fmt.Println("Is one in the map?", ok)
60+
5861
//output false
59-
fmt.Println ("Is three in the map?", ok)
62+
_, ok = set["three"]
63+
fmt.Println("Is three in the map?", ok)
6064
```

zh_CN/struct/struct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ set["one"] = struct{}{}
5050
set["two"] = struct{}{}
5151
5252
// Check if a value is in the map:
53-
_, ok := set["one"]
5453
5554
//output true
55+
_, ok := set["one"]
5656
fmt.Println("Is one in the map?", ok)
57-
_, ok = set["three"]
5857
5958
//output false
59+
_, ok = set["three"]
6060
fmt.Println("Is three in the map?", ok)
6161
```
6262

0 commit comments

Comments
 (0)