setdefault

Basic data handling: DictSetDefault

Returns the value for a key, setting a default if the key doesn't exist. This node takes a dictionary, a key, and a default value. If the key exists in the dictionary, the corresponding value is returned. If the key doesn't exist, the default value is inserted for the key and returned.

Pack: Basic data handling

custom_nodes.ComfyUI-basic_data_handling

Inputs (3)

NameTypeRequired
input_dictDICTrequired
keySTRINGrequired
default_value*required

Outputs (2)

NameType
DICTDICT
value*