Created
October 2, 2021 19:40
-
-
Save ryanc414/debb3a2a80a0e88fda7167b4025b240f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PrimaryColour int | |
const ( | |
Red = iota | |
Yellow | |
Blue | |
) | |
func (c PrimaryColour) String() string { | |
switch c { | |
case Red: | |
return "Red" | |
case Yellow: | |
return "Yellow" | |
case Blue: | |
return "Blue" | |
default: | |
panic(fmt.Sprintf("unknown colour %d", int(c))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment