Jump to content

continueloop


Recommended Posts

here's my code

while 1
...
   for $i = 1 to 10

      if $i=3 then

             continueloop
       
      endif
   next


wend

what i want is then $i = 3 ... the program will skip to the next while loop in stead of the for loop..

isnt' that i can add a loop level in the continue loop function ?

Link to comment
Share on other sites

here's my code

while 1
...
   for $i = 1 to 10

      if $i=3 then

             continueloop
       
      endif
   next
wend

what i want is then $i = 3 ... the program will skip to the next while loop in stead of the for loop..

isnt' that i can add a loop level in the continue loop function ?

The ContinueLoop keyword accepts a parameter for the level of nesting that you want to continue. The following exits the For/Next loop and continues the While/WEnd loop:

while 1
_MyFuncOne()
    for $i = 1 to 10
    _MyFuncTwo()
        if $i=3 then
             continueloop 2
        endif
    next
_MyFuncThree()
wend

You could just put ExitLoop and get out of the For/Next loop. Then the script would continue by executing _MyFuncThree() next.

The difference between this and using ContinueLoop is that _MyFuncThree() will not be executed. On hitting the ContinueLoop 2, the script will continue at While 1 and do _MyFuncOne() next.

:P

P.S. Edited to explain difference with ExitLoop.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...