diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-05-22 20:46:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 20:46:26 +0300 |
commit | 9ecd92c6fedd052f4115683726a5cc6ebaa33e85 (patch) | |
tree | 794a3df4990aa5397c7e284185b284bb956b6cb5 /docs/markdown/snippets | |
parent | f4194d4dbc5c48ff9a0d76c779876aab60754230 (diff) | |
parent | fe6fc59ee75f44acdaac0abc757c687916d4618a (diff) | |
download | meson-9ecd92c6fedd052f4115683726a5cc6ebaa33e85.zip meson-9ecd92c6fedd052f4115683726a5cc6ebaa33e85.tar.gz meson-9ecd92c6fedd052f4115683726a5cc6ebaa33e85.tar.bz2 |
Merge pull request #3490 from MathieuDuponchelle/dict_builtin
Add new built-in type, dict
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..1bd24ce --- /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 +``` |