//Byte
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Byte;
begin
x := MAXBYTE; //MAXBYTE是常数255
y := not x; //y 的值是 0
x := 5;
y := not x; //y 的值是 250
ShowMessage(IntToStr(y));
end;
//Word
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Word;
begin
x := MAXWORD; //MAXBYTE是常数65535
y := not x; //y 的值是 0
x := 5;
y := not x; //y 的值是 65530
ShowMessage(IntToStr(y));
end;
//Cardinal
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Cardinal;
begin
x := 4294967295; //Cardinal 类型的最大值
y := not x; //y 的值是 0
x := 5;
y := not x; //y 的值是 4294967290
end;
//Integer
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Integer;
begin
x := MaxInt; //MAXInt是常数2147483647
y := not x; //y 的值是 -2147483648, 也就是Integer的最小值
x := 5;
y := not x; //y 的值是 -6
y := not x + 1; //y 的值是 -5
end;