Last active
December 2, 2017 13:43
-
-
Save inancgumus/6f6c92165510767b4183b042d30287cc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// declare constants for the days in a week, and assign to them | |
// different numeric values. | |
// | |
// so, they won't clash. if both values of Sunday and Monday were 0, | |
// then, how could we know that which one is Sunday or Monday? | |
// | |
// this code is for this article: https://blog.learngoprogramming.com/golang-const-type-enums-iota-bc4befd096d3 | |
const ( | |
Sunday = 0 | |
Monday = 1 | |
Tuesday = 2 | |
Wednesday = 3 | |
Thursday = 4 | |
Friday = 5 | |
Saturday = 6 | |
) | |
fmt.Println(Sunday) // will display 0 | |
fmt.Println(Saturday) // will display 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment