[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.284 type

Synopsis

As a type declaration:
 
type
  type indentifier = type definition;
or with initialization:
 
type
  type indentifier = type definition value constant expression;

Description

The reserved word `type' starts the declaration of a type identifier which is defined by type definition. For further description see section 8.1.4 Type Declaration, section 8.1.4 Type Declaration, section 8.2.1 Type Definition, section 8.2 Data Types.

Conforming to

`type' is defined in ISO-7185 Pascal and supported by all known Pascal variants. Initializers are an ISO-10206 Extended Pascal extension.

Example

 
program TypeDemo;
type
  { This side is the }    { That side is the }
  { type declaration }    { type definition  }

{ array type } ArrayType = array [0 .. 9] of Integer;

{ record type } RecordType = record Bar: Integer end;

{ subrange type } SubrangeType = -123 .. 456;

{ enumeration type } EnumeratedType = (Mon, Tue, Wed, Thu, Fri, Sat, Sun);

{ set type } CharSetType = set of Char;

{ object type } ObjectType = object constructor Init; procedure Method; destructor Done end;

{ pointer type to another type identifier } PArrayType = ^ArrayType;

{ an alias name for another type identifier } IntegerType = Integer;

{ an integer which is initialized by 123 } InitializedInt = Integer value 123;

{ a schema with discriminants x and y of type Integer } SchemaType (x, y: Integer) = array [x .. y] of Integer;

begin end.

See also

section 8.1.4 Type Declaration, section 8.2.1 Type Definition, section 8.2 Data Types, section 8.1.5 Variable Declaration, section 9.14 array, section 9.222 record, section 9.175 object, section 9.244 set, section 9.196 Pointer, section 9.295 value.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html