1
0
Fork 0
mirror of https://github.com/vbatts/talks.git synced 2024-11-16 05:28:37 +00:00
talks/2013/03-golang-learning-lunch/5-neats/main.go

25 lines
469 B
Go
Raw Normal View History

2016-12-05 15:44:45 +00:00
package main
import "fmt"
func main() {
numbers := []int{1,7,3,8,2,4,5,4,9,0}
for i := range numbers {
fmt.Printf("index: %d\n", i)
}
for _, v := range numbers {
fmt.Printf("value: %d\n", v)
}
people := map[string]Person{}
people["shawking"] = Person{ Name: "Stephen Hawking", State: LIVING}
people["dritchie"] = Person{ Name: "Dennis Ritchie", State: DEAD}
for k,v := range people {
fmt.Printf("Key: %s; Object: %q\n", k, v)
}
}