1. Senior Member
Join Date
Dec 1969
Posts
290

Hi there,<BR><BR>I need to be able to do something similar to the following:<BR><BR>For x = 1 to 5<BR> If x = 3 Then<BR> Next<BR> End If<BR>Next<BR><BR>However, I receive the error "unexpected next"<BR><BR>Is there a way to have a loop skip to the next iteration? <BR><BR>Thanks!

2. Senior Member
Join Date
Dec 1969
Posts
115

For x = 1 to 5<BR>If x = 3 Then<BR>x=x+1<BR>End If<BR>Next<BR>

3. Senior Member
Join Date
Dec 1969
Posts
11,334

## I don't think there's a continue?

in VBS?<BR><BR>If not, try<BR>for.....<BR>if x = 3 then<BR> x= x + 1<BR>end if<BR>next

4. Senior Member
Join Date
Dec 1969
Posts
290

This solution won&#039;t skip over any code that&#039;s in the rest of the loop. <BR><BR>For example:<BR><BR>For x = 1 to 5<BR> If x = 3 Then<BR> next<BR> End If<BR> Response.Write ("....")<BR> Calculate this<BR> Calculate that<BR> Subroutine1<BR> If this then<BR> do that<BR> next<BR> Else<BR> do something else<BR> End If<BR>Next

5. Senior Member
Join Date
Dec 1969
Posts
11,334

## Jeez... so just do

For x = 1 to 5<BR>If x &#060;&#062; 3 Then<BR><BR><BR>Response.Write ("....")<BR>Calculate this<BR>Calculate that<BR>Subroutine1<BR>If this then<BR>do that<BR>next<BR>Else<BR>do something else<BR>End If<BR>End If<BR>Next

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•