View Single Post
Old 10-09-2008   #2 (permalink)
Bob Barrows [MVP]


 
 

Re: Is there a 'continue' construct for loops in VBScript

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.
>
Stop looking. Change the logic in your loop so that a continue statement
isn't needed. Typically an If statement is needed:
for ...
if ... then
'do something
elseif ... then
'do something else
else
'do nothing - essentially continuing the loop
end if
next

Select Case can also be used.

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


My System SpecsSystem Spec