Forum Discussion

nassim's avatar
nassim
Occasional Contributor
13 years ago

Breaking out of a while loop in VB

Hi,

I am using VB for Test Complete and have a while loop from which I want to exit in case an if case happens. I can not find out what I should use in this case. Exit While or Break do not work and somehow I find in Help of Test Complete just some declaration how break functions without writing in which language. Maybe I am using help not in a correct way. Please help me.

Thank you in advance

1 Reply

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Nassim,



    In VBScript, While loops don't support early exit. Use Do...Loop instead:

    Do While (Condition)

      ' Do something



      If (ExitCondition) Then Exit Do



      ' Do something else

    Loop