Go 语言基础教程:4.常量的使用
在这篇教程中,我们将通过一个简单的 Go 语言程序来学习常量的声明和使用。以下是我们要分析的代码:
package mainimport ("fmt""math"
)const s string = "constant"func main() {fmt.Println(s)const n = 500000000const d = 3e20 / nfmt.Println(d)fmt.Println(int64(d))fmt.Println(math.Sin(n))
}