Last active
August 29, 2015 14:07
-
-
Save jochasinga/1ffad9d7be8c374fff19 to your computer and use it in GitHub Desktop.
Struct in Go
This file contains hidden or 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 Gopher struct { | |
kingdom string | |
color map[string]int | |
num_legs int | |
height float | |
} | |
func main() { | |
chip := Gopher{ | |
"Animalia", | |
map[string]int{ | |
"r" : 102, | |
"g" : 255, | |
"b" : 255, | |
}, | |
4, 1.5, | |
} | |
fmt.Println(chip.kingdom) | |
fmt.Println(chip.color) | |
fmt.Println(chip.num_legs) | |
fmt.Println(chip.height) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment