golang iota

package main



import (

    "fmt" 

)



const (

    Low = 5 * (iota + 1)

    Medium

    High

)



func main() {

    //iota 是个从0开始逐行增1的变数

    fmt.Println(Low)//5

    fmt.Println(Medium)//10

    fmt.Println(High) //15

}

 

你可能感兴趣的:(golang)