This is simple program of using the for loop in QTP automation .
Steps to develop this program:
1. start a for net loop from 0 and end at 10
2. put a if statement inside the for loop and if condition satisfy exit the loop by writing “Exit For”
3. Print the loop counter values inside the loop.
For i = 0 To 10
If i=5 Then Exit For
document.write("The loop counter # " & i & "<br />")
Where to Run This Program:
1. This VBScript Program code either you can use in QTP editor (code between <script> and </script> tags ) and run it.
2. Write in Notepad, save with .htm extension and run on internet explorer.