Skip to content

Instantly share code, notes, and snippets.

@jgautheron
Created January 4, 2016 12:48
Show Gist options
  • Save jgautheron/ed3562e672c5b30d27e0 to your computer and use it in GitHub Desktop.
Save jgautheron/ed3562e672c5b30d27e0 to your computer and use it in GitHub Desktop.
switchenum
package main
const (
minimumCriteria itemCategory = iota
goodCitizen
extraCredit
)
type itemCategory byte
func main() {
val := goodCitizen
switch val {
case goodCitizen:
// do something
case extraCredit:
// do something
}
}
// $ switchenums .
// 13:12 The switch(val) instruction doesn't enumerate all enum values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment