Dictionary - iamgio/quarkdown GitHub Wiki
In Quarkdown, a dictionary is a collection of key-value pairs, without duplicate keys. A key is always a string value, while a value can be of any type.
The syntax for dictionaries recalls the YAML one, as it uses Markdown lists:
- key1: value1
- key2: value2
- key3: value3
If the called function accepts it (.localization
for instance), values can be nested dictionaries.
- English:
- greeting: Hello
- food: Fish and chips
- Italian:
- greeting: Ciao
- food: Pasta
Trailing colons that precede nested dictionaries are not mandatory and can be omitted:
- English
- greeting: Hello
- food: Fish and chips
- Italian
- greeting: Ciao
- food: Pasta
Operations
A dictionary can be passed to any function that accepts an iterable (it is treated as an iterable of pairs), along with:
.get {key} {dictionary}
.get {key} {dictionary} {orelse}
(fallback value if the key doesn't exist)