Skip to content

Commit 1a48f57

Browse files
authored
Merge pull request #4 from 0bvim/feat/section16
chore: hands on exercices
2 parents 3b671e7 + dc3b91a commit 1a48f57

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/udemy/go_ted/section16/main.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
favorites := make(map[string][]string)
7+
8+
favorites["bond_james"] = []string{"shaken, not stirred", "martinis", "fast cars"}
9+
favorites["moneypenny_jenny"] = []string{"intelligence", "literature", "computer science"}
10+
favorites["no_dr"] = []string{"cats", "ice cream", "sunsets"}
11+
12+
for key, value := range favorites {
13+
fmt.Println("Record for", key)
14+
for i, value := range value {
15+
fmt.Printf("%v - %v\n", i, value)
16+
}
17+
}
18+
fmt.Println("-------------------------")
19+
20+
delete(favorites, "bond_james")
21+
22+
for key, value := range favorites {
23+
fmt.Println("Record for", key)
24+
for i, value := range value {
25+
fmt.Printf("%v - %v\n", i, value)
26+
}
27+
}
28+
fmt.Println("-------------------------")
29+
30+
}

0 commit comments

Comments
 (0)