Parenthesis around if/for/while condition is not necessary
Timoses
timosesu at gmail.com
Sun Jun 24 23:40:56 UTC 2018
On Sunday, 24 June 2018 at 22:03:13 UTC, Dennis wrote:
> if (!("key" in dict)) {...}
if ("key" !in dict) {...}
At least that one has a shorter form. The others may be rewritten
to not have a leading "!" as well, e.g.
> if (!(t1.ty == Tarray && t2.ty == Tarray && needsDirectEq(t1,
> t2))
if (t1.ty != Tarray || t2.ty != Tarray || ...)
Plus, for counting brackets a text editor that highlights
enclosing opposite brackets really helps.
More information about the Digitalmars-d
mailing list