Does Go have an "if x in" construct for checking element membership like Python?
Hello everyone! I'm starting to learn Go after Python and ran into a small problem. In Python, I often used the `if x in list:` construct to check if an element is in a list. For example:
```python
fruits = ["apple", "banana", "cherry"]
if "banana" in fruits:
print("Found it!")
```
Very convenient and readable. But in Go, I haven't found a similar syntax. I tried to write something like:
```go
fruits := []string{"apple", "banana", "cherry"}
if "banana" in fruits { // Compilation error
fmt.Println("Found it!")
}
```
Go gives a compilation error. I understand that Go is a lower-level language, but is there really no built-in way to check if a slice or array contains a specific element? Maybe there is some function in the standard library? Or do I need to write a