Skip to content

Instantly share code, notes, and snippets.

@ytxmobile98
Created July 10, 2024 13:12
Show Gist options
  • Select an option

  • Save ytxmobile98/b05dd53d6f510f6681a69424f8c59e74 to your computer and use it in GitHub Desktop.

Select an option

Save ytxmobile98/b05dd53d6f510f6681a69424f8c59e74 to your computer and use it in GitHub Desktop.
Multi-level map in Go
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