Method code for $dictionary.setadd_elem()

[Turn on line numbering]
arg dict, key, elem;
var value;

value = (| dict[key] |);
if (type(value) != 'list && type(value) != 'error)
    throw(~type, "Value for key " + key + " (" + value + ") is not a list.");
anticipate_assignment();
if (value) {
    dict = dict_add(dict, key, 0);
    value = setadd(value, elem);
} else {
    value = [elem];
}
return dict_add(dict, key, value);

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon