!in operator

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Dec 26 07:56:34 PST 2010


Works in D2, but not in D1. Perhaps this is only a D2 feature?

On 12/26/10, Jacek Nowak <jaceknowak at wp.eu> wrote:
> Hi, I don't know if it's the right place for this, I prefer forums to
> newsgroups. Anyway, I am learning D and trying to work with associative
> arrays.
>
> Code (I'm using v1.065 of the DMD compiler):
>
> int[char[]] arr;
>
> if ("foo" in arr)
> {
> };
>
> if ("foo" !in arr)              // if (!("foo" in arr)) obviously works
> {
> };
>
>
> unfortunately, only the first "if" statement works, while the second one
> gives
> compiler errors:
>
> hello.d|72|found '!' when expecting ')'|
> hello.d|72|found 'in' instead of statement|
>
> now, according to http://digitalmars.com/d/1.0/expression.html
>
> "The !in expression is the logical negation of the in operation."
>
> is it a known bug or am I misunderstanding something?
>


More information about the Digitalmars-d-learn mailing list