DEV Community

Jesse Phillips
Jesse Phillips

Posted on

4

Check Dictionary has key in D

I'll just take the example from adding to a Dictionary.

string[int][string] data;
if("hello"!in data)
    data["hello"] = [95: "value"];
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more