The in operator and normal arrays
Bill Baxter
dnewsgroup at billbaxter.com
Wed Apr 25 16:52:18 PDT 2007
Myron Alexander wrote:
> Hello.
>
> I'm curious as to the reason for why the in operator only works with
> associative arrays. I am working on a program where having an in
> operator for a normal array would be useful. eg:
>
> if ("string" in ["string1", "string2", "string3", ...]) {
> do something
> }
>
> Is there some other way to do this in the language without resorting to
> a function or class method call?
>
> Thanks ahead,
>
> Myron Alexander.
I've proposed this before. Maybe others too. It makes sense. It's
what other languages with an 'in' operator do. It should work. It
doesn't. It isn't high on Walter's priority list because it can be
worked around easily.
--bb
More information about the Digitalmars-d
mailing list