Record is a structured data type. It contains some elements or fields, and each field can have a different data type. See the picture below.
How to declare a record ?
You have to declare a record after type clause.
type
RecordTypeName = record
Field_1 : DataType;
.
.
Field_n : DataType;
End;
var
RecordName : RecordTypeName;
For example, we declare a record named ItemStock that has three fields ( Item, Quantity and Price ).
type
TRecordItem = record
Item : string;
Quantity : integer;
Price : currency;
end;
var
ItemStock : TRecordItem;
First, define a TRecordItem then use it to declare a variable named ItemStock. So the ItemStock variable has three fields : Item, Quantity and Price.
0 comments:
Post a Comment