Continue For Loop

Hi all.

I'm struggling to find a way to move on a step in a loop.  The idea of below is that "Next Item" will never be echoed... but I'm getting a syntax error.. what have i done wrong?

dim i
for i = 0 to 3
	if i < 5 then
		WScript.Echo "1"
		Continue For
	end if
	WScript.Echo "Next Item"
next

I appreciate this looks like a rubbish script, but its an extrapolated short test, its just the general idea i need help with.

Using VBScript.


  • Edited by Ben Bell Thursday, November 28, 2013 5:23 PM
November 28th, 2013 8:23pm

There is no "Continue" in VBScript.

http://msdn.microsoft.com/en-us/library/tywtbxd0(v=vs.84).aspx

Free Windows Admin Tool Kit Click here and download it now
November 28th, 2013 8:31pm

Unfortunately VBScript does not have a "continue" statement that works in For or For Each loops.

You will need to use an If statement to skip the rest of your loop.

VBScript does, however, have the Exit For statement to exit from a For or For Each loop.

Bill

  • Marked as answer by Ben Bell Friday, November 29, 2013 8:34 AM
November 28th, 2013 8:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics