From 1de7dce41495a57404cefc6ecf3991c66e30f3ec Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Sun, 20 May 2018 22:35:14 +0200 Subject: dict: Document, add release snippet --- docs/markdown/snippets/dict_builtin.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/markdown/snippets/dict_builtin.md (limited to 'docs/markdown/snippets') 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 +``` -- cgit v1.1