Iterate Map

Examples Filter
package main

import "fmt"

func main() {
    // range on map iterates over key/value pairs.
    kvs := map[string]string{"a": "apple", "b": "banana"}
    for k, v := range kvs {
        fmt.Printf("%s -> %s\n", k, v)
    }

    // range can also iterate over just the keys of a map.
    for k := range kvs {
        fmt.Println("key:", k)
    }
}