24Using Maps for More Detailed Collections

Maps are a concept from other programming languages with a ton of different names. If you’re familiar with programming, you may know them as hashes or dictionaries. They are similar to lists in the sense that they can consist of many items. However, a map has a pair of items. These are known as the key and value. They’re incredibly useful for keeping track of more information than just a list. They keep twice the information and can act almost like collections of variables.

Take a look at the example for this task. There’s a map for some flower-themed colors. In the example, the names of the flowers—geranium, daffodil, iris—are the keys of the map. Their associated values are the hex colors. You can ...

Get Pragmatic Guide to Sass 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.