## 常量的類型
~~~go
const CONST [type] = value # 顯示
const CONST = value # 隱式
~~~
> 定義
> 常量在編譯時就已經確定
> 常量可由內置表達式計算,表達式中的函數必須是內置函數
> 只支持布爾型,數字型,字符串型
## 特殊常量iota
> iota在const關鍵字出現時,將會被重置為0
> const中每新增一行常量聲明iota計數一次(分組聲明中)
~~~go
const (
a = iota
b
c
)
fmt.Printf("a=%d b=%d c=%d", a, b, c)
~~~
### example
```go
package constant_test
import "testing"
const (
Readable = 1 << iota
Writable
Executable
)
func TestConstantTry1(t *testing.T) {
a := 1 //0001
t.Log(a&Readable == Readable, a&Writable == Writable, a&Executable == Executable)
}
```