"strtr" <st...@spam.com> wrote in message news:hjd6t1$be...@digitalmars.com... > This may be is a very basic question, but is there a way to let me omit a > repeating variable when doing multiple boolean operations? > > if ( var == a || var == b || var == c || var == d) > if ( var == (a || b || c || d) )
I do this: ------------------------- import tango.core.Array; void main() { if( [3, 5, 6, 12].contains(7) ) { } } ------------------------- There's probably a phobos equivilent, too. Alhough, I would much prefer what other people mentioned about having "in" refer to the values of a collection rather than the keys. But I've been using the above as a substitute.