Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit

Permalink
docs: add iter and clear
Browse files Browse the repository at this point in the history
Signed-off-by: rfyiamcool <[email protected]>
  • Loading branch information
rfyiamcool committed Jul 17, 2023
1 parent d31d567 commit 142ad23
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func main() {
m.Put("foo", 1)
m.Put("bar", 2)

m.Iter(func(k string, v int) (stop bool) {
println("iter", k, v)
return false // continue
})

if x, ok := m.Get("foo"); ok {
println(x)
}
Expand All @@ -36,12 +41,14 @@ func main() {
x, _ := m.Get("bar")
println(x)
}
}
```
```
1
2
-1

Program exited.
m.Clear()

// Output:
// iter foo 1
// iter bar 2
// 1
// 2
// -1
}
```

0 comments on commit 142ad23

Please sign in to comment.