RFC: Behavior of continue in do/while loops.

Regan Heath regan at netmail.co.nz
Thu Sep 13 01:23:38 PDT 2007


Downs wrote:
> Regan Heath wrote:
>> Downs wrote:
>>>> However,  if you think of 'continue' as meaning 'go to the next
>>>> iteration' then you would expect it to do whatever it would have done at
>>>> the end of this iteration, before the next one.
>>>> If you think of 'continue' as meaning 'go back to the start of
>>>> the(this?) loop' then you wouldn't expect the condition to be evaluated.
>>> The problem here is that for every case *but* a do/while loop, the two
>>> perspectives behave exactly the same. See my follow-up to the other post
>>> for a way to prevent this conflict.
 >>
>> I don't agree, 'go back to the start of this loop' simply isn't what
>> 'continue' does, in _any_ case.  In all cases when you execute continue
>> you move from iteration n to n+1.  Moving from one iteration to the next
>> _always_ involves checking the loop condition.
 >
> I know that's not what it _does_, but that wasn't my point.
> My point was that it _behaves_ the same, as seen from the *outside*,
> leading to misunderstandings.

I still don't agree that it "_behaves_ the same, as seen from the 
*outside*" but I wont labour the point.

Regan



More information about the Digitalmars-d mailing list