声明
Type
Student=record
Name:String;
Age:integer;
Grade:String;
Addr:String;
End;
Var
CollageStudent:Student;
-------------------------------------
或者直接声明
Var
CollageStudent:Record
Name:String;
Age:integer;
Grade:String;
Addr:String;
End;
赋值
procedure TForm1.FormCreate(Sender: TObject);
Var
CollageStudent:Student;
sTemp:String;
Begin
CollageStudent.Name:='张三'; //给Name域赋值
CollageStudent.Age:=22; //给Age域赋值
CollageStudent.Grade:='大四'; //给Grade:域赋值
CollageStudent.Addr:='长春市'; //给Addr域赋值
sTemp:=CollageStudent.Name; //访问Name域
//或者with结构语句
with COllageStudent do Begin
Name:='张三'; //给Name域赋值
Age:=22; //给Age域赋值
Grade:='大四'; //给Grade:域赋值
Addr:='长春市'; //给Addr域赋值
sTemp:=Name; //访问Name域
End;
End;
标签:String,记录,Age,Addr,CollageStudent,类型,Name,赋值 From: https://www.cnblogs.com/DQ-MINE/p/17124915.html《Delphi应用开发完全手册》p33