-
Notifications
You must be signed in to change notification settings - Fork 0
Dictionary variables in jask
Julius Paffrath edited this page Sep 11, 2018
·
3 revisions
A dictionary in jask is an unsorted collection of key-value pairs. Dictionary variables in jask can store any type of data, even lists and other dictionaries. Creating a new dictionary is straight forward:
store dictionary() in myDictionary
By creating a new dictionary, you can provide keys and values:
store dictionary("First Key":"First value":"Second Key":"Second value") in myDictionary
If you want to access the stored values, use the get functionality:
; this will print "First value"
printLine(dictionaryGet(myDictionary:"First Key"))
If you want to put new values in the dictionary, use the put functionality:
assign dictionaryPut(myDictionary:"New key":"New value") to myDictionary
You can easily iterate all mapped key-value pairs:
for key in dictionaryGetKeys(myDictionary)
printLine("Key ":key:" is mapped to value ":dictionaryGet(myDictionary:key))
endrun
Visit Internal Functions Wiki to see all implemented dictionary functions.
- Home
- Getting started
- Control flow
- Functions
- List variables in jask
- Dictionary variables in jask
- Structs in jask
- Convert variables
- Internal Functions
- The access operator
- Callbacks in jask
- Modules
- Internal Modules
- The jask standard library jcore
- Using CMD arguments in jask
- Nested function calls
- Functions inside functions!
- Modules inside functions!
- Performance comparison of loops