NeuroToxic Posted January 3, 2008 Share Posted January 3, 2008 (edited) Hi all, Sorry for my bad english, I'm french. I have a problem with a loop "For", I try to change the end parameter during the loop, but it does not work. It's possible to change the end parameter during the loop ? If yes can you help me ? This is my code (Normally, it should make an infinite loop): It takes as a end parameter, the array size. Each loop, increment the array size, so the end parameter too. Global $array[2] Global $loop = 0 $end = UBound($array) For $i = 1 To $end $loop += 1 ConsoleWrite("loop : " & $loop & @CRLF) ReDim $array[UBound($array) + 1] $end = UBound($array) Next Edited January 3, 2008 by NeuroToxic Link to comment Share on other sites More sharing options...
Nahuel Posted January 3, 2008 Share Posted January 3, 2008 Try with a 'custom made' For loop using While Wend. Global $array[2] Global $loop = 0 $end = UBound($array) $i=1 While $i <= $end $loop += 1 ConsoleWrite("loop : " & $loop & @CRLF) ReDim $array[UBound($array) + 1] $end = UBound($array) $i+=1 WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 3, 2008 Share Posted January 3, 2008 Try with a 'custom made' For loop using While Wend. Global $array[2] Global $loop = 0 $end = UBound($array) $i=1 While $i <= $end $loop += 1 ConsoleWrite("loop : " & $loop & @CRLF) ReDim $array[UBound($array) + 1] $end = UBound($array) $i+=1 WEnd How is either that or the OP's loop not infinite...? 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 More sharing options...
Nahuel Posted January 3, 2008 Share Posted January 3, 2008 How is either that or the OP's loop not infinite...? I'm confused... he wanted to modify the value of $end inside the loop, which is what I did. He said Normally, it should make an infinite loop, so I thought he wanted an infinite loop... Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 3, 2008 Share Posted January 3, 2008 I'm confused... he wanted to modify the value of $end inside the loop, which is what I did. He said Normally, it should make an infinite loop, so I thought he wanted an infinite loop...I figured that meant until a conditional statement did ExitLoop, or some such. Otherwise the script "Normally" crashes eventually with subscript out of bounds error. 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 More sharing options...
Nahuel Posted January 3, 2008 Share Posted January 3, 2008 I figured that meant until a conditional statement did ExitLoop, or some such. Otherwise the script "Normally" crashes eventually with subscript out of bounds error. His loop isn't infinite... it ends after two loops.Anyway, I just thought he wanted to figure out a way of modifying the conditional variable in a loop... so I gave him an idea Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 3, 2008 Share Posted January 3, 2008 His loop isn't infinite... it ends after two loops.Doh! I missed that in the help file:If stepVal or stop is a variable, its value is only read the first time the loop executes.You were right. 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 More sharing options...
NeuroToxic Posted January 4, 2008 Author Share Posted January 4, 2008 (edited) Try with a 'custom made' For loop using While Wend. Global $array[2] Global $loop = 0 $end = UBound($array) $i=1 While $i <= $end $loop += 1 ConsoleWrite("loop : " & $loop & @CRLF) ReDim $array[UBound($array) + 1] $end = UBound($array) $i+=1 WEnd Thank you, its work Edited January 4, 2008 by NeuroToxic Link to comment Share on other sites More sharing options...
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