Case Analysis of variable declaration in Go language
In this article Xiaobian for you to introduce in detail "Go language variable declaration case analysis", the content is detailed, the steps are clear, the details are handled properly, I hope this "Go language variable declaration case analysis" article can help you solve your doubts, following the editor's ideas slowly in depth, together to learn new knowledge.
Variable declaration
Specifies the variable type, which defaults to zero if it is not initialized.
Var v_name v_typev_name = value
Zero is the default value set by the system when the variable is not initialized.
Example
Package main
Import "fmt"
Func main () {
/ / declare a variable and initialize
Var a = "RUNOOB"
Fmt.Println (a)
/ / zero value without initialization
Var b int
Fmt.Println (b)
/ / zero value of bool is false
Var c bool
Fmt.Println (c)
}
The execution result of the above example is:
RUNOOB0false has read this, the "Go language variable declaration example analysis" article has been introduced, want to master the knowledge of this article still need to practice and use to understand, if you want to know more related articles, welcome to follow the industry information channel.