-
-
Save jackielii/4191c6b2ae5e0c06a180 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
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