Learn Go: Maps
Learn to use Maps to associate data in the Go language!
StartGo Maps
Lesson 1 of 1
- 1Think of a list of contacts on a phone. We can search by name to find the associated phone number. In programming, we often need to connect one data piece with another. This association is what map…
- 2In Go, there are two ways to create a map. We’ll be covering both in this exercise. #### Creating a map with make We can use the make function to create an empty map. The format is: variableNam…
- 3Maps make it easy to look up values and store the value in a variable for further use: variable := yourMap[keyValue] But what happens if we never added the requested key-value pair to the map bu…
- 4Maps are also easy to add key-value pairs or to change the value of an existing pair. In both cases we specify the map name, the key, and the value: yourMap[newKey] = newValue So to add a new cu…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory