1个子界的例子
代码
1 unit Unit1;
2 interface
3 uses
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls;
6 type
7 TForm1 = class(TForm)
8 Button1: TButton;
9 procedure Button1Click(Sender: TObject);
10 private
11 { Private declarations }
12 public
13 { Public declarations }
14 end;
15 var
16 Form1: TForm1;
17 implementation
18 {$R *.dfm}
19 var
20 i:integer;
21 procedure TForm1.Button1Click(Sender: TObject);
22 begin
23 i:=9;
24 if i in [1..7] then //子界表达式
25 showmessage('i<=7')
26 else
27 showmessage('9不在这个子界里面');
28 end;
29 end.
30
2 interface
3 uses
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls;
6 type
7 TForm1 = class(TForm)
8 Button1: TButton;
9 procedure Button1Click(Sender: TObject);
10 private
11 { Private declarations }
12 public
13 { Public declarations }
14 end;
15 var
16 Form1: TForm1;
17 implementation
18 {$R *.dfm}
19 var
20 i:integer;
21 procedure TForm1.Button1Click(Sender: TObject);
22 begin
23 i:=9;
24 if i in [1..7] then //子界表达式
25 showmessage('i<=7')
26 else
27 showmessage('9不在这个子界里面');
28 end;
29 end.
30



浙公网安备 33010602011771号