BrokenDynasty 0 Posted July 5, 2004 I have a 300 or so line script with a tangle of If/Else statements. I would like some of the Else's to instruct the script to start over again, how can I do this in the most simple way? Thanks in advance. Share this post Link to post Share on other sites
pekster 0 Posted July 5, 2004 Put it in a loop and cycle the loop for those statements you want to start over. Once you get out of your conditinal testing block, exit the loop. Example: While 1 $number = InputBox("Input A Number", "Enter a num", "0") $number = Number($number) If $number = 0 Then ContinueLoop ElseIf $number = 1 Then MsgBox(0, "", "You entered 1") ElseIf $number = 2 Then MsgBox(0, "", "You entered 2") ContinueLoop Else MsgBox(0, "", "You entered " & $number) EndIf ExitLoop WEnd [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Share this post Link to post Share on other sites
tutor2000 0 Posted July 5, 2004 I have a 300 or so line script with a tangle of If/Else statements. I would like some of the Else's to instruct the script to start over again, how can I do this in the most simple way? Thanks in advance.Look at case in the help fileIt really helped me out a lot when I started using itRick Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm Share this post Link to post Share on other sites
BrokenDynasty 0 Posted July 5, 2004 Does ContinueLoop exit the If statement the script is in and continue within the While Statement, to the next conditional? Share this post Link to post Share on other sites
pekster 0 Posted July 5, 2004 Does ContinueLoop exit the If statement the script is in and continue within the While Statement, to the next conditional?As soon as the ContinueLoop command is hit, it will cycle to the top of the loop. It will also iterate the count when dealing with a For loop. Note that when using a While loop this will test the condition before execution of the next loop cycle, but it will not for a Do-Until loop because the conditional testing comes at the end, not the top. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Share this post Link to post Share on other sites
Nutster 3 Posted July 6, 2004 I thought ContinueLoop actually goes to the bottom of the loop, which triggers incrementing for For or testing for Until. It then goes to the top of the loop and tests for For and While before going back into the loop. Let me see. $x = 1 $msg = "" Do $msg = $msg & ", " & $x $x = $x + 1 If $x > 5 And $x < 15 Then ContinueLoop Until $x > 10 $msg = StringTrimLeft($msg, 2) MsgBox(0, "Testing", $msg)If ContinueLoop does not trigger the test, then the result in $msg should go beyond 10. The result I get is:1, 2, 3, 4, 5, 6, 7, 8, 9, 10Therefore Do-Until is tested on ContinueLoop. David NuttallNuttall Computer ConsultingAn Aquarius born during the Age of AquariusAutoIt allows me to re-invent the wheel so much faster.I'm off to write a wizard, a wonderful wizard of odd... Share this post Link to post Share on other sites