Test for element in array

BCS BCS at pathlink.com
Fri Jul 14 09:23:40 PDT 2006


Don Clugston wrote:
> Andrei Khropov wrote:
> 
>> BCS wrote:
>>
>>>  if({foreach(i;a) if(i==j) return true; return false;}())
>>
>>
>> Yeah, this new delegate syntax is cool !
> 
> 
> Wow! I didn't know you could have a naked {} like that as a void 
> delegate. That is cool. Looks as though D has sucked all the juice out 
> of C++, and is moving onto the scripting languages...
> 

Not quite naked, without the ending () the type is "bool delegate(void)" 
a.k.a. always true.



More information about the Digitalmars-d-learn mailing list