1. Constant: the so-called constant, that is, the value determined during the program compilation stage, and the value cannot be changed during the program running. In the go program, constants can be defined as numerical values, Boolean values, strings, and other types.
Example 1-> Syntax
ConstConstantname =Value//If needed, you can also specify the type of the constant:ConstPi float32 =3.1415926
Example 2-> More forms
ConstPi =3.1415926ConstI =10000ConstMaxthread =10ConstPrefix ="Astaxie _"
Example3-> simple call example
Package mainimport"FMT"ConstPi float64 =3.14Func main () {FMT. printf ("% V", Pi )}
Different from general programming languages, go constants can specify a considerable number of decimal places (for example, 200 BITs). If float32 is specified, it is automatically shortened to 32bit, and float64 is automatically shortened to 64bit.