Does Go have “if x in” construct similar to Python?
There is no built-in operator to do it in Go. You need to iterate over the array. You can write your own function to do it, like this: func stringInSlice(a string, list []string) bool { for _, b := range list { if b == a { return true } } return false } Or … Read more