Dictionary error

Should a dictionary throw an error if it does not contain the specified key?

In the case of this example it is not possible to apply clear on the dictionary, because then there is this error that prevents the node to execute. Maybe it would be enough if there was a boolean on the GetItem node that shows if the item was found?

Try in this patch to first execute the Add node, and then the Clear node, afterwards it is kind of a dead end…

Dictionary.vl (9.5 KB)

What about TryGetValue ?

1 Like

Thanks!