go constants defined and enumerated types

const a,b int = 1,2

const a,b     = 1,2

const (

      a = "hello"

      b,c =3,4 

)

Constant value can be used as various types of

 

Enumerated type definition

Ordinary enumeration type

const (

      a = 1

      b = 2

      c = 3

)

 Increment enumerated type

Equivalent to const (

       a = iota

       b

       c 

)

 

Guess you like

Origin www.cnblogs.com/paulversion/p/11569465.html