Skip to content

Instantly share code, notes, and snippets.

@kjk
Created November 5, 2019 09:42
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 kjk/6c730ba2eae313952f1e5409e0fa7321 to your computer and use it in GitHub Desktop.
Save kjk/6c730ba2eae313952f1e5409e0fa7321 to your computer and use it in GitHub Desktop.
Methods
// :collection Essential Go
package main
import "fmt"
// :show start
type Person struct {
FirstName string
LastName string
}
func (p *Person) PrintFullName() {
fmt.Printf("%s %s\n", p.FirstName, p.LastName)
}
func main() {
p := &Person{
"John",
"Doe",
}
p.PrintFullName()
}
// :show end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment