02-25-2011, 01:49 PM
Well, this time it's not a bug, but a expected behaviour due to Ubyte overflow.
This question has already been answered here and previously here.
The problem comes because FOR a = 1 to 255 means "repeat until a > 255", since a is byte, that variable won't ever reach 256!.
This also happens in C and in other BASIC compilers. If you strinctly want to loop from 1 to 255 using uByte, use DO UNTIL looping statement:
Note, must use another PRINT before "Do" if you also want to print 0 (0 .. 255 => 256 times and so on.)
This question has already been answered here and previously here.
The problem comes because FOR a = 1 to 255 means "repeat until a > 255", since a is byte, that variable won't ever reach 256!.
This also happens in C and in other BASIC compilers. If you strinctly want to loop from 1 to 255 using uByte, use DO UNTIL looping statement:
Code:
Dim a as Ubyte = 0
Do
LET a = a + 1
PRINT a
Loop Until a = 255