Quick actions

cmd+k|ctrl+k

Navigation

Languages

Maps / Iterate a map with range / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:13:28Z

Updated

2019-03-26T10:13:28Z

package main

import "fmt"

func main() {
	people := map[string]int{
		"john": 30,
		"jane": 29,
		"mark": 11,
	}

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