Created
July 10, 2024 13:12
-
-
Save ytxmobile98/b05dd53d6f510f6681a69424f8c59e74 to your computer and use it in GitHub Desktop.
Multi-level map in Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| var m = map[int]map[int]struct{}{ | |
| 1: {2: struct{}{}}, | |
| } | |
| func main() { | |
| for _, item := range [][2]int{ | |
| {1, 2}, | |
| {1, 3}, | |
| {2, 3}, | |
| {3, 4}, | |
| } { | |
| _, ok := m[item[0]][item[1]] | |
| println(ok) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment