boolean over multiple variables
strtr
strtr at spam.com
Fri Jan 22 14:49:58 PST 2010
BCS Wrote:
> Hello Strtr,
>
> > 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) )
> >
>
> bool B;
> switch(var) { case a,b,c,d: B = true; break; default B = false; break; }
> if(B)
>
> or you can put the then/else parts right in the switch
>
Not really what I had in mind, but works yes.
More information about the Digitalmars-d-learn
mailing list