外网设计灵感网站,南阳河南网站建设价格,如果网站已被入侵,上海小微企业名录查询常量
//显式类型定义const a string test
//隐式类型定义const b 20
//多个常量定义 const(c test2d 2.3e 27)iota
iota是Golang语言的常量计数器#xff0c;只能在常量表达式中使用 iota在const关键字出现时将被重置为0#xff0c;const中每新…常量
//显式类型定义const a string test
//隐式类型定义const b 20
//多个常量定义 const(c test2d 2.3e 27)iota
iota是Golang语言的常量计数器只能在常量表达式中使用 iota在const关键字出现时将被重置为0const中每新增一行常量声明将使iota计数一次
const (first iotasecond iotathird iota
)const (first_1 iotasecond_1 third_1)const (first_2 iota1second_2 third_2)func main() {fmt.Println(first, second, third)fmt.Println(first_1, second_1, third_1)fmt.Println(first_2, second_2, third_2)
}
输出结果 注 iota是const语句块中的行索引而不是变量索引其计数只与const语句块中的行数相关
const (d1 iota //0d2 20 //20d3 iota //2
)