Get the App
SLTechnology News&Howtos  ›  Development  › 

How to apply constant in Go language

Shulou Source: shulou.com Published: 2022-06-01 02:34:14 09月11日 Update

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.

Tags: Content constants applications languages examples articles knowledge articles area value most that is more steps knowledge points results industry information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MySQL Docker Shulou Tech Info Microsoft