Help with repeat command
mynet43
Posts: 644
I've been tracking a little bug for a while and I finally found the problem.
The code I'm running is:
cols := 128 (really a constant in the CON block)
yloc := 0 (xloc, yloc and loc are all longs in the VAR block)
repeat xloc from cols - 1 to 0 step -1
loc := xloc + yloc*cols
if screen[noparse][[/noparse]loc] <> $20 ' continue until first non-space char
quit
This is part of a routine to process the end key on the keyboard.
In debugging this, I found that the "step -1" doesn't work (even when I make it a variable, I also tried -2).
The value of xloc stays at 127...
When I remove the "step -1", the loop works perfectly.
The syntax looks like the example on page 296 of the manual.
Can someone see what I'm doing wrong?
Thanks for your help.
Jim
The code I'm running is:
cols := 128 (really a constant in the CON block)
yloc := 0 (xloc, yloc and loc are all longs in the VAR block)
repeat xloc from cols - 1 to 0 step -1
loc := xloc + yloc*cols
if screen[noparse][[/noparse]loc] <> $20 ' continue until first non-space char
quit
This is part of a routine to process the end key on the keyboard.
In debugging this, I found that the "step -1" doesn't work (even when I make it a variable, I also tried -2).
The value of xloc stays at 127...
When I remove the "step -1", the loop works perfectly.
The syntax looks like the example on page 296 of the manual.
Can someone see what I'm doing wrong?
Thanks for your help.
Jim
Comments
It seems like step -1 should mean what it says[noparse]:)[/noparse]
For now, I'll just leave off the "step".
Thanks again.
Jim