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

Commit

Permalink
Merge pull request #14 from rfyiamcool/docs/iter_clear
Browse files Browse the repository at this point in the history
docs: add iter and clear
  • Loading branch information
reltuk authored Jul 26, 2023
2 parents 2142724 + 142ad23 commit df81ed4
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 df81ed4

Please sign in to comment.