How to apply constant in Go language
Most people do not understand the knowledge points of this article "how to apply Go language constants", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to apply Go language constants" article.
The following example demonstrates the application of constants:
Example
Package main
Import "fmt"
Func main () {
Const LENGTH int = 10
Const WIDTH int = 5
Var area int
Const a, b, c = 1, false, "str" / / multiple assignment
Area = LENGTH * WIDTH
Fmt.Printf ("area is:% d", area)
Println ()
Println (a, b, c)
}
The running result of the above instance is as follows:
Area: 501 false str above is about the content of this article on "how to use Go language constants". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.