DEV Community

Discussion on: Go from the beginning - working with loops

Collapse
 
jonasbn profile image
Jonas Brømsø

Hi @softchris

Nice write up, I do not know if you skipped it deliberately, but I find the iteration over maps quite essential for programming Go and I believe it qualifies for a mention, with maps being an fundamental data type.

kvs := map[string]string{"a": "apple", "b": "banana"}
for k, v := range kvs {
    fmt.Printf("%s -> %s\n", k, v)
}
Enter fullscreen mode Exit fullscreen mode

Example lifted from Go By Example: Range

Will keep reading, so keep it up

Collapse
 
softchris profile image
Chris Noring

Thank you, I've added your example above.