Skip to content

Instantly share code, notes, and snippets.

View l-vitaly's full-sized avatar
🏠
Working from home

Vitaly Lobchuk l-vitaly

🏠
Working from home
View GitHub Profile
type Permissions int
const (
  Read Permissions = 1 << iota // 1 << 0 = 00000001
  Write // 1 << 1 = 00000010
  Create // 1 << 2 = 00000100
 Delete // 1 << 3 = 00001000
)
type CarType int
const (
BMW CarType = iota // 0
  Audi // 1
Mercedes // 2
  _
  _
  XRay // 5
)
func FormatMyValue(i int) string {
return fmt.Sprintf(“there are %d my value”, i)
}
func main() {
n := TypicalPhlegmaticPerson
fmt.Println(FormatMyValue(n))
}
// output:
@l-vitaly
l-vitaly / example1
Last active February 26, 2017 11:11
type TemperamentЕype int
const (
TypicalSanguinePerson TemperamentЕype = iota // 0
  TypicalCholericSubject // 1
  TypicalPhlegmaticPerson // 2
  TypicalMelancholiac // 3
)