Declare a map:
1 2 3 4 5 6 7 8 9 // Nil map: Read-Only var di map[string]string dict := map[string]string{ "good": "iyi", "great": "harika", "perfect": "mükemmel", } Delete an element of the map using delete builtin:
1 delete(dict, "awesome") Retrieve an value from map:
Copy slice to another slice:
1 2 3 4 5 6 7 8 evens := []int{2, 4} odds := []int{3, 5, 7} N := copy(evens, odds) fmt.Printf("%d element(s) are copied.\n", N) // evens after copy is, [3, 5] // odds is intact after copy, [3, 5, 7] copy can be used over append if want to keep length of target slice intact.
non-constant array bound max Array length is not a constant.
slice can only be compared to nil Invalid comparison between slices. Slice can only be compared to nil.