I am getting the ascii character set when this program runs while I was expecting it to print from 0 to 255.
global sub main()
{
def b as unsigned byte;
for(b=0; b<256;b++)
{
print(b," ",);
while getkey() ="";// gives you time to see what is happening. I just hold it down till I am done.
}
while getkey() ="";// the program doesn't get here, so I just close the window
}
The Print function translates it to a displayable character. Convert it to an int, or just add zero ;)
print(b+0,"",);
Adding zero elevates it to an integer. You can also use NumToStr
print(NumToStr(b), "" ,);
Thanks Paul :)
Why can't you cast the character to an integer, C-style?
Because this isn't C.
No, but some type of casting is really needed. Either a new unary operator, like %(int)byte_var, or something like the word "cast" would work - cast(int)byte_var (this is what the D language uses).