Skip to content

Instantly share code, notes, and snippets.

@t-redactyl
Created March 15, 2017 00:45
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 t-redactyl/3116fe568d3067d378141286d34f4cee to your computer and use it in GitHub Desktop.
Save t-redactyl/3116fe568d3067d378141286d34f4cee to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
type Saiyan struct {
Name string
Power int
Father *Saiyan
}
func main() {
gohan := &Saiyan{
Name: "Gohan",
Power: 1000,
Father: &Saiyan{
Name: "Goku",
Power: 9001,
Father: nil,
},
}
fmt.Printf("%s's power is %d, and his father is %s.", gohan.Name, gohan.Power, gohan.Father.Name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment