"if not" condition check (for data validation)
Stanislav Blinov
stanislav.blinov at gmail.com
Thu Jun 18 00:43:40 UTC 2020
On Wednesday, 17 June 2020 at 23:46:54 UTC, Denis wrote:
> `if` is not a good substitute, because it works in the opposite
> sense, often requiring lots of `not`s. As a trivial example:
>
> assert( configfile.isFile && configfile.extension == ".conf" )
> -vs-
> if ( !configfile.isFile || configfile.extension != ".conf" )
> A BETTER SOLUTION ???
>
> I haven't been able to come up with another option that is more
> efficient yet doesn't sacrifice readability. I would welcome
> suggestions.
>
> Thanks in advance.
> Denis
if( ! (configfile.isFile && configfile.extension == ".conf") )
?
More information about the Digitalmars-d-learn
mailing list