type ta = (a,b,c,d); tb = set of ta; var x1,x2: tb; begin x1 := [a,b]; x2 := [a,b,c,d]; if x1 <= x2 then ShowMessage('x1 <= x2'); if x1 >= x2 then ShowMessage('x1 >= x2'); if x1 = x2 then ShowMessage('x1 = x2'); if x1 <> x2 then ShowMessage('x1 <> x2');
用交集,結果是a和c,就表示存在const CompareSet=[a]+[c];var s: TStatus; begin s:=[a]+[c]+[d]; if s*CompareSet=CompareSet then showmessage('s中包含CompareSet'); end;
用=号就不行了
ta = (a,b,c,d);
tb = set of ta;
var
x1,x2: tb;
begin
x1 := [a,b];
x2 := [a,b,c,d];
if x1 <= x2 then
ShowMessage('x1 <= x2');
if x1 >= x2 then
ShowMessage('x1 >= x2');
if x1 = x2 then
ShowMessage('x1 = x2');
if x1 <> x2 then
ShowMessage('x1 <> x2');
s: TStatus;
begin
s:=[a]+[c]+[d];
if s*CompareSet=CompareSet then
showmessage('s中包含CompareSet');
end;
可以這樣表示
s:=[a,c,d];