Skip to content

Instantly share code, notes, and snippets.

@inancgumus
Last active December 2, 2017 13:43
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 inancgumus/6f6c92165510767b4183b042d30287cc to your computer and use it in GitHub Desktop.
Save inancgumus/6f6c92165510767b4183b042d30287cc to your computer and use it in GitHub Desktop.
// 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