golang iota

 
  
/**
  golang iota
*/
package main
import (
    "fmt"
    _ "strconv"
)
var p = fmt.Println
const (
    A = 123
    B
)
const (
    C = "string"
    D
)
const (
    E = iota * 3
    F
)
const (
    G = iota * 3
    H
    I = 8 * iota
    K
    L = 14
    M
)
func main() {
    p("A:", A)
    p("B:", B)
    p("------------")
    p("C:", C)
    p("D:", D)
    p("------------")
    p("E:", E)
    p("F:", F)
    p("------------")
    p("G:", G)
    p("H:", H)
    p("I:", I)
    p("K:", K)
    p("L:", L)
    p("M:", M)
}


 
 

你可能感兴趣的:(golang)