Wednesday 9 June 2010

Record

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

These links are part of a pay per click advertising program called Infolinks. Infolinks is an In Text advertising service; they take my text and create links within it. If you hover your mouse over these double underlined links, you will see a small dialog box containing an advertisement related to the text. You can choose to move the mouse away and go on with your browsing, or to click on the box and visit the relevant ad. Click here to learn more about Infolinks Double Underline Link Ads.