Use .get() in MultiD Assoc Array?
Paul
phshaffer at gmail.com
Thu Aug 30 10:18:22 PDT 2012
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.
More information about the Digitalmars-d-learn
mailing list