Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exiting For statement
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
I have 3 For statements. I have an If x = 2, I want the k For loop to Exit. But, instead the i For loop i[/quote]s being exited.

Code:
For i = 1 to 4
  For j = 1 tp 5
     For k = 1 to 6
         If x = 2 then
            Exit For
         End If
     Next
  Next
Next

How can I Exit the k For loop?
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,
"For...Next" but not "For ... Do".

Thanks,
Sridhar
Thanks,
SUpputuri
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
I was in a hurry, I changed it.... thx ;-)
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,

The code is correct and the only K For Loop will be exited. May be you are making some other mistake. Could you please paste the rest of the code.

Regards,
Parminder
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
Parminder,

Thx! I thought it should work as you mentioned. I ended up removing the "K" For loop and replaced with a counter. So, I think I am in good shape now.

Lorena
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error when exiting windows application qtpbegin 0 2,257 07-21-2012, 05:20 PM
Last Post: qtpbegin

Forum Jump:


Users browsing this thread: 6 Guest(s)