Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 395 Bytes

dicts.md

File metadata and controls

17 lines (12 loc) · 395 Bytes

Dictionaries

Type X{} maps string keys to values of X.

let dict = {"a": 13, "b": 20}
# type: i32{}
# maps "a" to 13 and "b" to 20

🔥 Access might fail, if a key is not present. That's why optionals X? are returned and need to be unwrapped before usage (see error handling):

for value in dict["a"]
    print(value)