02-03-2026, 04:27 PM
(02-02-2026, 05:34 PM)Pete Wrote:You just solved an issue I was having last week where I was like "NO...this is NOT a duplicate definition !?!". After banging my head against the wall, calling in the drywall crew to fix it, and doing it again - I just gave up. Now I know what was happening there. UGH !!!Code: (Select All)GoSub pete
Print MyArray(1)
End
pete:
ReDim MyArray(10)
MyArray(1) = 5
Return
So again the program flow seems like it should handle the situation, as the Gosub statement leads us to the Redim of the array, before we print the array value. Ah, but the coding order shows that from top down, we tried to print the value before we dimensioned the array. So the fix is simple, just remember to...
Code: (Select All)ReDim MyArray(0) ' We'll increase this value in the Gosub.
GoSub pete
Print MyArray(1)
End
pete:
ReDim MyArray(10)
MyArray(1) = 5
Return
So please share other examples where coding order effects outcome, regardless of program flow, in this thread.
Pete
THANKS!

