Join David Gassner for an in-depth discussion in this video Storing unordered values in maps, part of Learning Go.
- A Map in Go is an unordered collection…of key value pairs.…It's essentially a hash table that lets you store…collections of data and then arbitrarily find…items in the collection by their keys.…A map's keys can be of any type that's comparable.…That is, the keys can be compared to each other…for purposes of sorting, but it's pretty common…to use strings for keys and then any other type…for the associated values.…You can declare an empty map and initialize it…with built-in make function, like this.…
I'll declare a map that I'll name, "states,"…and then, I'll assign it using the make function.…I'll pass in the keyword, map,…and then, between a pair of brackets,…I'll set the type of the keys.…I'll send it to string, and then, I'll declare…the type of the associated values after the closing bracket,…and that will also be a string.…So my map will have keys and values that are both strings.…I'll use the Print line function…and display the map in its current state.…
And I see the type of the object, map,…and the pair of brackets with nothing between,…
- Installing Go tools
- Creating and compiling a Go workspace
- Exploring variables, constants, and types
- Storing ordered and unordered values
- Grouping related values in structs
- Programming conditional logic and loops
- Defining and calling functions
- Handling errors
- Working with files
- Creating a simple HTTP server
Skill Level Beginner
Programming the Google App Engine with Javawith Patrick Royal2h 4m Intermediate
Google App Engine Essential Trainingwith Joseph Lowery3h 26m Intermediate
1. Getting Started
2. Essential Go Skills
3. Managing Simple Values
4. Managing Complex Types and Collections
5. Managing Program Flow
6. Structuring Go Code
7. Working with Files and the Web
Next steps2m 26s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.