Loop iterator - example.txt

Sean Kelly sean at f4.ca
Sat Apr 29 18:53:28 PDT 2006


Bruno Medeiros wrote:
> 
> The remaining case, where you want to use continues and retries in the 
> same for, well, I don't think it's a common enough case that makes it 
> worth the introduction of a new keyword just some trivial syntactic sugar.
> In fact, the very idea seems like a very awkward idiom to me. I would 
> like to examine a real example, can someone post one?

Deleting selected members of a sequence:

     for( int i = 0; i < a.length; ++i )
     {
         if( isMatch( a[i] ) )
         {
             swap( a[i], a[$-1] );
             a.length = a.length - 1;
             retry;
         }
     }


Sean



More information about the Digitalmars-d mailing list