"Todd Vargo" <tlvargo@xxxxxx> wrote in message
news:edzFuNlKJHA.4600@xxxxxx
Quote:
> Andrew Falanga wrote: Quote:
>> Hi,
>>
>> As you might have guessed, both from this post and the one I made
>> yesterday, I'm a VBScript neophyte. I'm looking on MSDN but, as yet,
>> cannot find a construct such as 'continue' for loops. I'm assuming
>> that many in this forum are familiar with languages like C or Java and
>> will recognize this keyword.
>>
>> I need a way to start at the top of a For Each loop if a specific
>> condition is met, but can't seem to find Continue. I shall keep
>> looking while awaiting replies.
>
> It sounds like either you want to Exit from the loop or are looking for
> the
> Next statement.
>
> For Each ...
> If condition = True Then Exit For
> Next Sounds more like he wants to abort the current iteration and go directly to
the next one, not actually exit the loop entirely. I think that is what the
"continue" construct does in those other languages he mentions.
Bob Barrows had the best solution, however it reflects only one model. Here
is the generic continue:
for each ...
do some stuff before deciding
if A continue (i.e. start the next iteration of the loop now)
do some more stuff
next
This maps to:
for each ...
do some stuff before deciding
if not A then
do some more stuff
end if
next
It gets more complicated if the choice to continue is nested more deeply in
some other loop of if block... I agree with Bob on the approach: don't try
to map a continue'd structure in a language lacking continue... think the
problem through a different way that uses only the available constructs.
/Al