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
}
原文地址:https://www.cnblogs.com/rojas/p/4460287.html