diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2018-05-20 22:35:14 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2018-05-20 22:39:33 +0200 |
commit | 1de7dce41495a57404cefc6ecf3991c66e30f3ec (patch) | |
tree | 12221939b48b3d4660d752059101c807289141c8 /docs/markdown/snippets | |
parent | 195c356f918d9d617ec8705cd459732ff1418650 (diff) | |
download | meson-1de7dce41495a57404cefc6ecf3991c66e30f3ec.zip meson-1de7dce41495a57404cefc6ecf3991c66e30f3ec.tar.gz meson-1de7dce41495a57404cefc6ecf3991c66e30f3ec.tar.bz2 |
dict: Document, add release snippet
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r-- | docs/markdown/snippets/dict_builtin.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/markdown/snippets/dict_builtin.md b/docs/markdown/snippets/dict_builtin.md new file mode 100644 index 0000000..b60fd0a --- /dev/null +++ b/docs/markdown/snippets/dict_builtin.md @@ -0,0 +1,19 @@ +## New built-in object dictionary + +Meson dictionaries use a syntax similar to python's dictionaries, +but have a narrower scope: they are immutable, keys can only +be string literals, and initializing a dictionary with duplicate +keys causes a fatal error. + +Example usage: + +```meson +dict = {'foo': 42, 'bar': 'baz'} + +foo = dict.get('foo') +foobar = dict.get('foobar', 'fallback-value') + +foreach key, value : dict + # Do something with key and value +#endforeach +``` |