Loop iterator - example.txt

Derek Parnell derek at psych.ward
Sun Apr 30 15:19:07 PDT 2006


On Mon, 01 May 2006 05:18:11 +1000, Sean Kelly <sean at f4.ca> wrote:

> Bruno Medeiros wrote:
>>  I was thinking of an example which used continues and retries in the  
>> same for, as yours can be cleanly rewritten as the example in my later  
>> post.
>> Anyway, Derek's example serves as a good example of the keyword's  
>> usage, but for "foreach", for "for" I'm still finding it a bit odd.
>
> I think it's more useful for "foreach" because there's no way to avoid  
> progressing with each iteration.  However, goto still works here as in  
> Walter's example.  "retry" is handy, but it's more a convenience than  
> anything.

And *expressive*. That is, it signals the coder's intent more clearly than  
a goto can because in theory the goto can go to anywhere but that is not  
the case with 'retry'. Thus the use of 'retry' is more likely to lead to  
less misunderstanding and bugs. So even though it is a 'goto' in disguise,  
it is a controlled goto.



-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list