“Continue” (to next iteration) on VBScript

后端 未结 8 774
陌清茗
陌清茗 2021-02-03 17:43

A colleague and I were trying to figure out a way of doing the equivalent of a \"continue\" statement within a VBScript \"For/Next\" loop.

Everywhere we looked we found

8条回答
  •  广开言路
    2021-02-03 18:06

    Implement the iteration as a recursive function.

    Function Iterate( i , N )
      If i == N Then
          Exit Function
      End If
      [Code]
      If Condition1 Then
         Call Iterate( i+1, N );
         Exit Function
      End If
    
      [Code]
      If Condition2 Then
         Call Iterate( i+1, N );
         Exit Function
      End If
      Call Iterate( i+1, N );
    End Function
    

    Start with a call to Iterate( 1, N )

提交回复
热议问题