VERY Odd code/variable behavior
xanatos
Posts: 1,120
UPDATE: I rearranged the order of the VARs and put d NIB(6) last, and the problem disappeared. Am I misreferencing the array somehow?
Update #2... Uhm, gee, Dave. Yes, d(6) would be the 7th element of d, since you only specify 6, you're overwriting the next var, which is x, and then whichPump, so, yes, you are misreferencing your array variable... -- Sincerely, Dave. :-)
Hi there,
As usual, if something really odd can be found, it will be found in my code. Case in point: I have the following sections of code - VARs and the code in question:
AND
Note that the code in this slot is very sparse and simple, what you see here is pretty much the only active area of concern to this question, which is: In the DEBUG window, when I run this code, I get these outputs:
Before clearing the d(x)'s: 1
After clearing the d(x)'s: 0
whichPump is set earlier in my program and is only used in LOOKUPS as in LOOKUP whichPump, [2, 5, 8, 13, 21...], x
x is a general purpose variable in my code. Something in that single for/next loop is clearing whichPump back to zero.
Any clues what I'm missing here?
It makes about as much sense to me as if I cleaned out my silverware drawer and my closet got emptied. There should be, as far as I know, no relationship between these things. I am utterly perplexed.
Thanks for your help,
Dave
Update #2... Uhm, gee, Dave. Yes, d(6) would be the 7th element of d, since you only specify 6, you're overwriting the next var, which is x, and then whichPump, so, yes, you are misreferencing your array variable... -- Sincerely, Dave. :-)
Hi there,
As usual, if something really odd can be found, it will be found in my code. Case in point: I have the following sections of code - VARs and the code in question:
d VAR Nib(6) ' Mileage number holders x VAR Byte ' Ye olde GP counter var whichPump VAR Nib ' Pump actively being keyed for.
AND
DEBUG "Before clearing the d(x)'s: ",DEC whichPump, CR FOR x = 1 TO 6 d(x) = 0 NEXT DEBUG "After clearing the d(x)'s: ",DEC whichPump, CR
Note that the code in this slot is very sparse and simple, what you see here is pretty much the only active area of concern to this question, which is: In the DEBUG window, when I run this code, I get these outputs:
Before clearing the d(x)'s: 1
After clearing the d(x)'s: 0
whichPump is set earlier in my program and is only used in LOOKUPS as in LOOKUP whichPump, [2, 5, 8, 13, 21...], x
x is a general purpose variable in my code. Something in that single for/next loop is clearing whichPump back to zero.
Any clues what I'm missing here?
It makes about as much sense to me as if I cleaned out my silverware drawer and my closet got emptied. There should be, as far as I know, no relationship between these things. I am utterly perplexed.
Thanks for your help,
Dave
Comments
update: I think I was writing this during your update.
Dave