🍯 Dictionaries

Published Aug 4, 2021Updated Jun 8, 2023
Contribute to Docs

🍯, or dictionary or hash map in other languages, is an ordered set of value pairs:

🔤key🔤 ➡️ 🔤value🔤

It provides a way to map pieces of data to each other, and allows for quick access to values associated to keys. Keys must be unique in dictionaries, but the values don’t have to be.

Syntax

🏁 🍇
🍿
🔤fr🔤 ➡️ 🔤Salut!🔤
🔤it🔤 ➡️ 🔤Ciao!🔤
🔤de🔤 ➡️ 🔤Guten Tag!🔤
🔤en🔤 ➡️ 🔤Hey!🔤
🔤es🔤 ➡️ 🔤Hola!🔤
🔤cn🔤 ➡️ 🔤你好!🔤
🔤jp🔤 ➡️ 🔤こんにちは!🔤
🍆 ➡️ dictionary
🍉

🍿 is used to list key value pairs, where each key is separated from its value with a ➡️. This will create an instance of 🍯, which is stored into dictionary.

🍯 is implemented as a hash table and is O(1) on average and O(n) in worst case.

All contributors

Looking to contribute?

Learn Emojicode on Codecademy