In theory, a boolean is a single bit and so can only be 1 or 0, while a byte is 8 bits and so can range from 0 to 255. However, I'm a bit confused because DBPro lets me do this:
Test as Boolean
Test = 255
Print Str$(Test)
rem You can even calculate with this value!
Test = Test - 100
Print Str$(Test)
Wait key
End
and for me it prints 255, which it shouldn't.
I don't think I'm overwriting memory outside the boolean field, though, as this code works:
Type Test
One as Boolean
Two as Boolean
EndType
Dim TestArray(0) as Test
TestArray(0).Two = 0
TestArray(0).One = 255
Print TestArray(0).One
Print TestArray(0).Two
Wait key
End
I have two boolean fields next to each other and set TestArray(0).One to 255, which (if I am overwriting memory) should change TestArray(0).Two from zero - yet it doesn't. It's as though each boolean field has a full byte of memory associated with it.
So, is the Boolean field here really a Byte by another name?
We spend our lives chasing dreams. Dark Basic lets us catch some of them.