How to make Associative Array to return key value for non-existing key?Folks,
Is there any way to make a default value in associated array dynamic?
Meaning that if you try to access a key that does not exist, it returns not a static default value, but some lambda function, for instance - the key itself? Or key*2, or key||"_string".
Automation and ScriptingRe: How to make Associative Array to return key value for non-existing key?I don't think you can make the returned value dynamic. You could use Try(), but I think a function could be better option to handle the missing values
Names Default To Here(1);
ex = Associative Array({"red", "blue"}, {1, 2});
Try(ex["green"], "green");