Multiple variables can be declared using a single statement.
Version
Go 1.17.7
package main
import "fmt"
func main() {
msg, name := "Hello", "World"
fmt.Println(msg, name)
}
Hello
is formsg
variable,World
is forname
variable respectively- Type is inferred automatically by Type Inference
Conclusion
- It is so concise to declare multiple variables in one line