Code: Select all
Function()
{
if( rock )
my_var := my_value
do_some_stuff()
if( rock )
break_rock( my_var )
}
Edit: forgot bracket
Code: Select all
Function()
{
if( rock )
my_var := my_value
do_some_stuff()
if( rock )
break_rock( my_var )
}
Code: Select all
for index, element in myArray {
;..........
}
msgbox % index
Yeah, I did. And it worked. But I can't count the number of times I've been burned by trusting my own tests instead of learning to do something correctly. And this is a scenario where AHK is very different than pretty much every other programming language out there. Normally, such a variable would be destroyed when the block scope exits. And depending on how AHK works behind the scenes, it may still function correctly, even while using a variable that was deleted or had its memory recycled.