Constants are the most basic elements in the program and cannot be reassigned after definition. Constant types in Go language include boolean constants, integer constants, floating point constants, character constants, string constants and complex constants.
Boolean constants
const x = true
(x) //Output true
Integer constants
const x = 20
(x) //Output 20
Floating point constant
constx = 0.618
(x) //Output %f0.618
Character constants
const x = 'a'
(x) //Output 97
String constants
const x = "a"
(x) //Output a
Complex constants
const x = 3 + 2i
(x) //Output %v(3+2i)
If you look closely, you will find that the output values of 'a' and 'a' are different. The single quoted 'a' represents a character, and the double quoted 'a' represents a string. In Go language, '1', "1" and 1 are different values, which are the same as C language. If you are interested, you can try the output of children's boots by yourself.
The above is the entire content of this article, I hope you like it.