The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
422 B
18 lines
422 B
5 years ago
|
## Adding dictionary entry using string variable as key
|
||
|
|
||
|
New dictionary entry can now be added using string variable as key,
|
||
|
in addition to using string literal as key.
|
||
|
|
||
|
```meson
|
||
|
dict = {}
|
||
|
|
||
|
# A variable to be used as a key
|
||
|
key = 'myKey'
|
||
|
|
||
|
# Add new entry using the variable
|
||
|
dict += {key : 'myValue'}
|
||
|
|
||
|
# Test that the stored value is correct
|
||
|
assert(dict[key] == 'myValue', 'Incorrect value retrieved from dictionary')
|
||
|
```
|