I have a dictionary element of type array<string>:
dictionary d = { {'arr', array<string>(1, "something")} };
I now want to retrieve this entry into a local variable:
//array<string> arr = cast<array<string>>(d['arr']); // works
//array<string>@ arr = null;
//bool found = d.get('arr', @arr); // works (found == true)
//array<string> arr;
//bool found = d.get('arr', arr); // doesn't work (found == false)
array<string> arr;
bool found = d.get('arr', @arr); // doesn't work (found == true, but arr variable is empty)
Could you help me understand why the 3rd and 4th options don't work?
On an unrelated note, if I can directly instantiate an array of ints like so:
array<int> arr = {,3,4,}
Why does this not work?
array<string> arr = {"a", "b", "c"}; // "Argument cannot be assigned. Output will be discarded" compiler warning