Why is boolean true represented as -1?
Delphi
3
Posts
2
Posters
15
Views
1
Watching
-
I just wrote a program and used the BoolToStr() function to convert the boolean value true to a string so I could read it in a WriteLn statement. Much to my surprise the screen represented true as -1. Can someone explain?
-
I just wrote a program and used the BoolToStr() function to convert the boolean value true to a string so I could read it in a WriteLn statement. Much to my surprise the screen represented true as -1. Can someone explain?
-
I meant why is boolean true represented as a negative number instead of a positive number. Like in C++ boolean true is represented as 1. But I guess since true is represented by any non-zero integer I can see why -1 works just as good.