Development‎ > ‎VBScript‎ > ‎

Continue statement

One of the syntax feature I miss quite a lot in VBScript is the "continue" statement within a loop.

The code below is quite redable when the loop logic is short:
For Each oFolder In oParentFolder.SubFolders
    If not bCondition Then
         'Loop logic goes here
    End If
Next


Nesting can be reduced by adding a workaround for the "continue" statement.

For Each oFolder In oParentFolder.SubFolders:Do While True
    If bCondition Then
        Exit Do 'continue
    End If
 
    'Loop logic goes here
Exit Do;Loop:Next


Comments