03-maps/

directory
v0.0.0-...-35bbffe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2015 License: Apache-2.0

README

Maps - Arrays, Slices and Maps

Maps provide a data structure that allow for the storage and management of key/value pair data.

Notes

  • Maps provide a way to store and retrieve key/value pairs.
  • The map key must be a value that can be used in an assignment statement.
  • Iterating over a map is always random.

http://blog.golang.org/go-maps-in-action

http://www.goinggo.net/2013/12/macro-view-of-map-internals-in-go.html

Code Review

Declare, initialize and iterate (Go Playground)

Map literal initialization (Go Playground)

Map key restrictions (Go Playground)

Advanced Code Review

Composing maps of maps (Go Playground)

Exercises

Exercise 1

Declare and make a map of integer values with a string as the key. Populate the map with five values and iterate over the map to display the key/value pairs.

Template (Go Playground) | Answer (Go Playground)


Ardan Labs Ardan Studios GoingGo Blog


All material is licensed under the Apache License Version 2.0, January 2004.

Directories

Path Synopsis
advanced
example1
Sample program to show how to compose maps of maps.
Sample program to show how to compose maps of maps.
Sample program to show how to declare, initialize and iterate over a map.
Sample program to show how to declare, initialize and iterate over a map.
Sample program to show how to declare and initialize a map using a map literal.
Sample program to show how to declare and initialize a map using a map literal.
Sample program to show how only types that can have equality defined on them can be a map key.
Sample program to show how only types that can have equality defined on them can be a map key.
exercises
exercise1
Declare and make a map of integer values with a string as the key.
Declare and make a map of integer values with a string as the key.
template1
Declare and make a map of integer values with a string as the key.
Declare and make a map of integer values with a string as the key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL