From the book a way to respond to a non-existent key in an assoc. array:

assert(aa["hello"] == "ciao");
// Key "hello" exists, therefore ignore the second argume
assert(aa.get("hello", "salute") == "ciao");
// Key "yo" doesn’t exist, return the second argument
assert(aa.get("yo", "buongiorno") == "buongiorno");

Should this work in multidimensional arrays?

aa.get("key1" "key2" "key2", "nonexistent") == "sometext"

Thanks for your time.

Reply via email to