Go to the first, previous, next, last section, table of contents.

Record Types

RECORD <fieldDecl> { ";" <fieldDecl> ... } END ";"

where

<fieldDecl> = <id> [ ":" <type> ]  [ ":=" <constant expr> ]

Record types group related data items together in a unified data structure. Each data item, or field, has a name, a type, and an optional constant initializer. If you supply the constant initializer, you can omit the type; it will be inferred from the constant. Here are some examples:

TYPE
  (* Record type with uninitialized fields *)
  Rec1 = RECORD
    x, y: INTEGER;
    name: TEXT
  END;  

  (* Record type with initialized fields *)
  Rec2 = RECORD
    x, y := 0; (* Type is INTEGER *)
    name := "" (* Type is TEXT *)
  END; 


Go to the first, previous, next, last section, table of contents.