| Description |
Returns one of the following values :
| Source is false and Target is false | Gives <0 |
| Source is false and Target is true | Gives -1 |
| Source is true and Target is false | Gives 1 |
| Source is true and Target is true | Gives 0 |
Where the Source is the current Boolean.
The exact return value is not guaranteed.
|
|
| Microsoft MSDN Links |
System
System.Boolean
|
|
|
| A simple example |
program Project1;
{$APPTYPE CONSOLE}
var
aFalse, aTrue : Boolean;
result : Integer;
begin
aFalse := false;
aTrue := true;
result := aFalse.CompareTo(TObject(aFalse));
Console.WriteLine('aFalse compared to aFalse = {0}', result.ToString);
result := aFalse.CompareTo(TObject(aTrue));
Console.WriteLine('aFalse compared to aTrue = {0}', result.ToString);
result := aTrue.CompareTo(TObject(aFalse));
Console.WriteLine('aTrue compared to aFalse = {0}', result.ToString);
result := aTrue.CompareTo(TObject(aTrue));
Console.WriteLine('aTrue compared to aTrue = {0}', result.ToString);
Console.ReadLine;
end.
| | Show full unit code | aFalse compared to aFalse = 0
aFalse compared to aTrue = -1
aTrue compared to aFalse = 1
aTrue compared to aTrue = 0
|
| |
|
|
|