Actually, the reason that
BASIC represents
True as -1 is pretty simple, and has nothing to do with whether or not the
integer is
signed or not (BASIC doesn't have
unsigned integers, so that question is pretty
moot). The reason BASIC does it is because of it's very relaxed
coercion rules.
In BASIC, when coercing numbers for a
boolean expression, any non-zero number is coerced to True, and zero is coerced to False. So, for instance, the following works fine:
If 4 Then Print "You betcha."
Now, BASIC also has no concept of
boolean operators: AND, OR, and NOT are all
bitwise operators. For NOT, especially, this can create a
gotcha that trips up those not expecting it.
If 4 Then Print "You betcha."
If Not 4 Then Print "You betcha."
Both of these statements will print. Why? Well, 4, as a
signed integer, looks like this:
00000100
Not 4, then, looks like this:
11111011
Which is equivalent to 251. And 251 is, of course, coerced to true if you use it in a boolean expression. So, to avoid the problem of having (Not True) = True, the numeric value of True has to be such that (Not True) = False. Since False is:
00000000
True must therefore be:
11111111
Which is, when signed, -1. (Were it unsigned, it would be 255, which is not exactly a whole lot more intuitive)