golang 常量的用法

1.Golang常量的用法

//常量的用法
	var num int
	num =9 
	
	//1.常量声明的时候必须赋值
	const tax int = 0
	
	//2.常量值是无法修改的
	//tax = 10
	
	//3.常量只能修饰bool,数值类型(int,float系列)、string类型
	
	//4.常量的自增
	const(
		a = iota
		b
		c
	)
	fmt.Println(a,b,c)  // 0 1 2

----------------------------------【喜欢打赏】-------------------------------------------

小主,辛苦啦!文章棒棒哒,赏杯咖啡吧...
打赏

----------------------------------【喜欢打赏】-------------------------------------------

原文地址:https://www.cnblogs.com/tomtellyou/p/10464137.html