On Saturday, 13 May 2017 at 00:36:55 UTC, mogu wrote:
```d
if (null)
    "1".writeln;
if ("")
    "2".writeln;
if ("" == null)
    "3".writeln;
```

Output:
2
3

How to understand this?

Boolean conversion on an array works on array's pointer, not it's length. So even though `"".length == 0`, `"".ptr != null`, and so `cast(bool)"" == true`.

Reply via email to