Let’s learn about dictionaries in Go.

We'll cover the following


A dictionary is a data structure that associates values with keys (just like a hash table). The key-value pairs in a dictionary are not kept in a sorted order since it employs a hash table. Duplicate keys are not permitted in the dictionary, but identical values are allowed.

Code example

Let’s look at an example where we map integers to certain fruits:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.