Use the VaR keyword to declare a group of variables.
In the function parameter, declare the change and put the type to the end.
1Package main
2
3 Import "FMT"
4
5VaR x, y, z int
6VaR C, Python, Java bool
7
8Func main (){
9FMT. println (X, Y, Z, C, Python, Java)
10}
0 0 0 false False false
Variables declared using the VaR keyword can be none of the initialization values.
If an initialization value exists, the type of each variable can be omitted. It automatically determines the type based on the initial value type.
1Package main
2
3 Import "FMT"
4
5VaR x, y, z Int = 1, 2, 3
6VaR C, Python, Java = true, false,"No!"
7
8Func main (){
9FMT. println (X, Y, Z, C, Python, Java)
10}
1 2 3 true false no!
In a function, you can use the: = value assignment statement instead of VaR to hide declarations of the type.
In addition to the function, no build can start with: =.
1Package main
2
3 Import "FMT"
4
5Func main (){
6VaR x, y, z Int = 1, 2, 3
7C, Python, Java: = true, false,"No!"
8
9FMT. println (X, Y, Z, C, Python, Java)
10}
1 2 3 true false no!