Skip to content

Instantly share code, notes, and snippets.

@jackielii
Forked from kylelemons/enum.go
Created June 22, 2014 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackielii/4191c6b2ae5e0c06a180 to your computer and use it in GitHub Desktop.
Save jackielii/4191c6b2ae5e0c06a180 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type day int
const (
Sunday day = iota
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
)
var dayNames = [...]string{
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
}
func (d day) String() string {
return dayNames[d]
}
func main() {
fmt.Println(Tuesday)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment