Skip to content

Instantly share code, notes, and snippets.

@todd-dsm
Created July 5, 2021 21:05
Show Gist options
  • Save todd-dsm/7d980a4f4b11971020c4e8204cda4c9a to your computer and use it in GitHub Desktop.
Save todd-dsm/7d980a4f4b11971020c4e8204cda4c9a to your computer and use it in GitHub Desktop.
stylistically which is most correct, cards or the letter d?
// create a 'reciever' function
// this construct establishes methods on the variables we create
//-----------------------------------------------------------------------------
// 'cards' is a reference to the main.go/main variable: (presently instantiated) cards
func (cards deck) print() {
for index, card := range cards {
fmt.Println(index, card)
}
}
//-------------- same thing with a d
func (d deck) print() {
for index, card := range d {
fmt.Println(index, card)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment