“Continue” (to next iteration) on VBScript

后端 未结 8 761
陌清茗
陌清茗 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-03 18:26

    We can use a separate function for performing a continue statement work. suppose you have following problem:

    for i=1 to 10
    
    if(condition) then   'for loop body'
    contionue
    End If
    
    Next
    

    Here we will use a function call for for loop body:

    for i=1 to 10
    Call loopbody()
    next
    
    function loopbody()
    
    if(condition) then   'for loop body'
    Exit Function
    End If
    
    End Function
    

    loop will continue for function exit statement....

提交回复
热议问题