Iterate over elements of map



examples/iterate-over-map/iterate_over_map.go
package main

import "fmt"

func main() {
    grades := make(map[string]int)
    grades["Mary"] = 99
    grades["Jane"] = 88
    grades["Bob"] = 93

    for key, value := range grades {
        fmt.Printf("%-4s  %d\n", key, value)
    }
}

Mary  99
Jane  88
Bob   93