I'm not sure this is really the right place for this question but I couldn't find a general programming forum.

Why are the numeric values -1 and 0 used to represent the logical values TRUE and FALSE?

No particular reason to ask this, I'm just curious!

David

Neither of them explain why -1 is used. It mentions that true is a non-zero value '(such as 1 or -1)', but that's it.
In VB and earlier versions of BASIC it's always been -1.
Anyway, not a big deal, just curious.

>Neither of them explain why -1 is used.

True means True and False means False. False is 0 because there is nothing. True is anything non-zero, because there is SOMETHING.

yeah i think your missing my point.
i was curious about why specifically the value -1 was used (yes i know it could have been any non-zero value)
a boolean variable takes up 2 bytes of storage so that it can accomodate values 0 and -1 but only a single bit is actually required to distinguish between the two values. i suspect this is because its actually the same data type as a signed 16 bit integer.
anyhow, there doesn't seem to be any clear answer to this so i think i'll drop this rather idle query...

mmm an interesting discussion going on there...
i dont want to add to it as i dont have sufficient knowledge at the right level (i.e. compilers), but it was interesting to note that no-one asked what the design goal of the new language was.
as someone who tries (or used to anyway) write efficient code I find it puzzling that single boolean values take up so much wasted space in a database.
i have had occassion to write code that packs several boolean values into a single integer but in these days of almost limitless memory and data storage capacity it doesnt seem important. Even using a Byte storage field can cause problems as it doesn't map easily when binding data to interface controls that expect a 'Boolean'.
Anyhow... more important things to worry about so I'm getting back to the real world of development... thanks for the comments and link.

David