The puzzles from this category allow you to create and operate on dictionary values.

Visual programming blocks to work with dictionaries



Dictionaries are very useful when you need to store, transfer, and retrieve various data in the same entity. Particularly, a dictionary is useful for storing multiple parameters and for passing them in bulk to Puzzles (such as raycast or collision info), JavaScript, or over network.

For example you might define a car with the following dictionary:

Dictionary example

... which internally looks like this:

{ "available": true, "brand": "Tesla", "model": "Model S", "range": 250, "year": 2020 }

Inside the curly brackets are dictionary items. Each item has a key (e.g. "model") and a value ("Model S") associated with it. Keys are always defined as strings, but values can be of any type (strings, numbers, booleans, lists, other dictionaries, etc.) Also, contrary to lists, there is no particular sorting order applied to dictionary items, so you can add them in arbitrary order.

Puzzles Reference

create empty dict

Returns a dictionary containing no data records.

Create empty dictionary in visual programming editor

Internally in JavaScript, an empty dictionary is represented by an object without any properties, that is { }.

create dict with

Returns a dictionary with given keys and values.

Block to create dictionary with given key-value pairs

Keys/values can be lists:

Dictionary keys and values as lists

or multi-line texts, where each line represents a key or value:

Dictionary keys and values as text strings

dict set key

Sets the item to be associated with a specified key in a dictionary. The key must be a text, while the assigned value may be of any type (text, number, list, other dictionary, etc).

Visual programming block to set dictionary key

dict get key

Returns the item associated with a specified key in a dictionary.

Visual programming block to retrieve values from dictionaries

get keys

Returns a list of all keys present in a dictionary.

Visual logic block to retrieve all keys from dictionary

dict check key

Checks if a specified key is present in a dictionary, and returns the Boolean-typed result true or false.

Checking dictionary key with visual programming

dict remove key

Removes the item associated with a specified key in a dictionary, and deletes the key itself.

Block to remove dictionary key

is empty

Checks if a specified dictionary contains no keys, and returns the Boolean-typed result true or false.

Visual logic block to check if dictionary is empty

See Also

Having Troubles with Puzzles?

Seek help on the forums!