How to split a string into parts and assign them to variables in Go?
Hello everyone! I just started learning Go, and I have a problem that seems elementary, but I can't find the right solution.
I need to split a string, for example, "John:25:Developer", into separate parts and assign them to variables: name, age, job. In other languages, like Python, I would just write `name, age, job = "John:25:Developer".split(":")`. But in Go, I can't find such a simple way.
I tried using `strings.Split()`, but it returns a slice of strings, not separate variables. Here is my code:
```go
package main
import (
"fmt"
"strings"
)
func main() {
data := "John:25:Developer"
parts := strings.Split(data, ":")
// How to assign parts[0] to name, parts[1] to age, parts[2] to job?
fmt.Println(parts)
}
```