bennyvo Posted March 29, 2005 Posted March 29, 2005 hi, is it possible to have a loop in an infinite loop? eg. while 1 = 1 loop 20 procedure 1 loop15 procedure 2 loop 2 procedure 3 Wend i want procedure 1 to be repeat 20 time then it start on procedure 2 for 15 times then do procedure 3 for 2 time2 and repeat all over again in an infinite loop. is it possible? can someone give me a hand? thanks a lot.
layer Posted March 29, 2005 Posted March 29, 2005 (edited) You can have a Do...Until loop inside a While loop, or even a For...Next loop. Example:While 1 For $i = 5 to 1 step -1 MsgBox(0, $i, $i) Next MsgBox(0, "Lift off!", "Huston, we have lift off.") WendThat will run a For...Next loop inside of a While...WEnd loop. I don't think it's possible to run a While...WEnd loop inside of another While...WEnd loop, it doesn't even make sense. EDIT: Now I see what your saying... The above example I provided should get you off on the write track Edited March 29, 2005 by layer FootbaG
buzz44 Posted March 29, 2005 Posted March 29, 2005 (edited) Do...Until $a = 0 $b = 0 $c = 0 While 1 Do ;Procedure 1 $a = $a + 1 Until $a = 20 Do ;Procedure 2 $b = $b + 1 Until $b = 15 Do ;Procedure 3 $c = $c + 1 Until $c = 2 $a = 0 $b = 0 $c = 0 Wend For...Next While 1 For $i = 20 to 1 step -1 ;Procedure 1 Next For $i = 15 to 1 step -1 ;Procedure 2 Next For $i = 2 to 1 step -1 ;Procedure 3 Next Wend not sure if u can use the same constant variable $i for each loop, maybe have to change While Loop $a = 0 $b = 0 $c = 0 While 1 While $a <> 20 ;Procedure 1 $a = $a + 1 Wend While $b <> 15 ;Procedure 1 $b = $b + 2 Wend While $c <> 2 ;Procedure 3 $c = $c + 1 Wend $a = 0 $b = 0 $c = 0 Wend , what ever floats your boat Edited March 29, 2005 by burrup qq
MHz Posted March 29, 2005 Posted March 29, 2005 While 1 For $i = 20 to 1 step -1 ;Procedure 1 Next For $i = 15 to 1 step -1 ;Procedure 2 Next For $i = 2 to 1 step -1 ;Procedure 3 Next Wendnot sure if u can use the same constant variable $i for each loop, maybe have to changeThe $i used in your example, is a local (counter) variable in For loops. So your example is OK.
russell Posted July 17, 2011 Posted July 17, 2011 That will run a For...Next loop inside of a While...WEnd loop. I don't think it's possible to run a While...WEnd loop inside of another While...WEnd loop, it doesn't even make sense. EDIT: Now I see what your saying... The above example I provided should get you off on the write track I know this is far dead, im just amazed how far we have come muppet hands are so soft :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now