GO基础学习之常量

1、常量简介

         所谓常量,也就是在程序编译阶段就确定下来的值,而程序在运行时则无法改变该值。在Go程序中,常量可定义为数
值、布尔值或字符串等类型。

2、常量语法
           const constantName = value
    注: 如果需要,也可以明确指定常量的类型, 如:const Pi float32 = 3.1415926


下面是一些常量声明的例子:
const Pi = 3.1415926
const  prefix = "astaxie_"

猜你喜欢

转载自blog.csdn.net/m_S_L/article/details/84567581