syntax idea: simplifed ifs
Ameer Armaly
ameer_armaly at hotmail.com
Mon Apr 10 16:18:55 PDT 2006
"dennis luehring" <dl.soluz at gmx.net> wrote in message
news:e1ekp6$jr7$1 at digitaldaemon.com...
> for example how often do we use constructs like
>
> if( x == 10 && x == 20 && x == 30 )
>
> simplified:
> if( x == [10 && 20 && 30] )
>
> if( a >= h && b >= h && c >= h )
>
> simplified:
> if( [a && b && c] >= h )
>
> (just an idea)
>
> ciao dennis
Considering that you can't have multiple assignments to a variable, if you
had that many possible OR conditions,, couldn't you just use a combined
switch like so:
switch(x)
{
case 10:
case 20:
case 30:
...
default:
break;
}
This still leaves open the issue of multiple variables though; what you
suggest may work.
More information about the Digitalmars-d
mailing list