Does it have to be For/Next? In a For/Next
loop you can use Exit For:
For Each OFile in oFiles
If oFile.Name = "SomethingOrOther.txt" then exit for
'-- other ops here
Next
If you can use a Do loop then you have other options.
There are While and Until keywords. (Look it up
in the WSH CHM help file.) There's also Exit Do:
Do While x = 0
'-- ops here.
Loop
Do
If x = 0 then Exit Do
'-- ops here.
Loop
Quote:
> 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.
>
> Thanks for any help,
> Andy