How to Exit For Loop in QTP

To get Exit for loop in QTP you must use Exit For Statement.

Exit For  statement will get the control out of the for loop and execute first statement  outside for loop.

Example -
Below code demonstrates the exit for use in QTP -

    For ct = 1 to 3
             TempNum = mid(Tempstr,ct,1)
              If isnumeric(TempNum) Then
                LengthNum = LengthNum &TempNum
               Else
                  Exit For
               End If
            Next
        GetStrLenNumber = LengthNum