1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
type MailingListRecord = record { 声明记录用关键字record}
FirstName: string ;
LastName: string ;
Address: string ;
City: string ;
State: string ;
Zip: Integer ;
end ;
var MLRecord: MailingListRecord; { 定义一个该记录的变量}
begin { 当使用记录时,用小圆点来访问它的字段}
MLRecord . FirstName := 'Bruce' ;
MLRecord . LastName := 'Reisdorph' ;
MLRecord . Address := '123 Inspiration Pt.' ;
MLRecord . City := 'Merced' ;
MLRecord . State := 'CA' ;
MLRecord . Zip := 99999 ;
{ 使用with语句来简化上面的字段的输入}
{ with表示“用这个对象'MLRecord'做下列”}
with MLRecord do
begin
FirstName := 'Bruce' ;
LastName := 'Reisdorph' ;
Address := '123 Inspiration Pt.' ;
City := 'Merced' ;
State := 'CA' ;
Zip := 99999 ;
end ;
{ with可以减少键入量,同时也使程序可读性更强}
end ;
|