Associative array .get with .init as default second argument
Torarin
torarind at gmail.com
Thu Oct 21 16:02:16 PDT 2010
2010/10/18 bearophile <bearophileHUGS at lycos.com>:
> In what cases is this useful? Are you able to show me an example of situation where it is useful?
>
> Bye,
> bearophile
>
Bearophile, I probably didn't make it very clear, so I'll try again:
Now:
if (headers.get("transfer-encoding", "") == "chunked")
More appealing in my opinion:
if (headers.get("transfer-encoding") == "chunked")
In other words: "Does this key-value pair exist?"
Another example from the HTTP domain:
if(headers.get("connection", "") == "close")
More information about the Digitalmars-d
mailing list