parent
51d0e02292
commit
adb4e071e6
4 changed files with 51 additions and 11 deletions
@ -0,0 +1,17 @@ |
||||
## 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') |
||||
``` |
@ -0,0 +1,12 @@ |
||||
project('add dictionary entry using string variable as key', meson_version: '>=0.52') |
||||
|
||||
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') |
Loading…
Reference in new issue