Check Dictionary has key in D
(Source/Credits: https://dev.to/jessekphillips/check-dictionary-has-key-in-d-h7d)
I'll just take the example from adding to a Dictionary. string[int][string] data; if("hello"!in dat...
I'll just take the example from adding to a Dictionary.
dlang
string[int][string] data;
if("hello"!in data)
data["hello"] = [95: "value"];
The in
operator is not made available to arrays. It is expected to have a time complexity of O(1) which is possible with dictionary but not a list.
Comments section