Check/Compare a value using "in"
    MattCoder 
    mattcoder at hotmail.com
       
    Fri Nov  2 18:42:19 PDT 2012
    
    
  
Hi,
I need to check if some value exists in a list (Array). To 
achieve that, I'm using Associative Arrays like this:
// Example
void main()
{
   int[char] aa = [ '+' :  0, '-' : 1];
   char ch = '+';
   if(ch in aa)
     // doSomething()...
}
But I'm looking for a more simple way like:
if(ch in ['+', '-'])    // <- This doesn't works
    // doSomething()...
Or another simple way (if exists of course).
Thanks.
    
    
More information about the Digitalmars-d-learn
mailing list