9951 explained code solutions for 126 technologies


golangHow to use ENUM type


package main
 
const (
  North int = iota
  South
  East
  West
)

func main() {
  print(East)
}ctrl + c
const (

defines enum constants

int = iota

assign int value to given constant and auto incremented value starting from 0

East

will have int value of 2