syntax idea: simplifed ifs
Derek Parnell
derek at psych.ward
Mon Apr 10 17:01:35 PDT 2006
On Tue, 11 Apr 2006 00:24:14 +0200, dennis luehring wrote:
> Derek Parnell wrote:
>> On Tue, 11 Apr 2006 08:04:21 +1000, dennis luehring <dl.soluz at gmx.net>
>> wrote:
>>
>>> 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)
>>
>> A good one too, in my opinion. The || symbol would also be useful.
>>
>> if ( [a || b || c] >= h )
>
> or think of
>
> if( [a || b || c ] >= [ h && b ] )
Not sure what that would mean ... is it ...
if ( (a >= h || b >= h || c => h) && ((a >= b || b >= b || c => b)))
OR
if ( (a >= h && a >= b) || (b => h && b >= b) || (c => h && c >= b) )
I think the idea should be kept at one '[...]' group only and one of
'&&','||' per group ( that is ... don't mix && and || inside the [] ).
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
11/04/2006 9:57:47 AM
More information about the Digitalmars-d
mailing list