集合的基础问题
type
myset=set of 0.. 5;
var
testset: myset;
begin
testset := [0,1,5];
if 33 in testset then
ShowMessage('33 in testset!');//这句会执行,如果是34以上则不会执行,why?
end;
贴全以点,如果把代码方到函数里就不会有问题,这样才会又问题:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
myset=set of 0.. 5;
var
Form1: TForm1;
testset: myset;
implementation
{$R *.dfm}
begin
testset := [0,1,5];
if 33 in testset then
ShowMessage('33 in testset!');//这句会执行,如果是34以上则不会执行,why?
end.