Sign in to follow this  
Followers 0
chun914

continueloop

7 posts in this topic

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 ?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

while 1

...

for $i = 1 to 10

if $i=3 then continueloop

next

wend

The continueloop should be exitloop

The exitloop will exit the for/next loop and place you in the while loop

Share this post


Link to post
Share on other sites

The continueloop should be exitloop

The exitloop will exit the for/next loop and place you in the while loop

So does ContinueLoop 2, but it depends if if you want to continue the loop or restart the loop.

Share this post


Link to post
Share on other sites

yeah...thanks so much

Share this post


Link to post
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
Sign in to follow this  
Followers 0