Skip to content

Instantly share code, notes, and snippets.

@kjk
Created Nov 5, 2019
Embed
What would you like to do?
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