注册 登录
编程论坛 Delphi论坛

集合的基础问题

anthony634 发布于 2007-03-30 11:53, 540 次点击

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;

2 回复
#2
anthony6342007-03-30 14:37

楼上你这个垃圾

#3
anthony6342007-03-30 14:38

贴全以点,如果把代码方到函数里就不会有问题,这样才会又问题:
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.

1