🍯 Dictionaries

🍯, 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.

Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn Emojicode on Codecademy

Edit this page on GitHub

Contributors