'in' for arrays?

Egor Starostin egorst at gmail.com
Wed Dec 6 00:42:20 PST 2006


> I keep wanting to say
>    if (val in somearray) {
>    }
Me too.

For example, in Python I can write

if val in ('off','disable','no')

and in D I have to write

if (val == "off" || val == "disable" || val == "no")

which is less readable (to me, at least).


--
Egor



More information about the Digitalmars-d mailing list