Created
March 15, 2017 00:45
-
-
Save t-redactyl/3116fe568d3067d378141286d34f4cee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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