VMS Help
PASCAL, Declaration Section, Value Declaration

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  If you choose, you can use the VALUE section as a Compaq  Pascal
  extension  that  initializes  ordinal, real, array, record, set,
  and string variables.  (If you require portable  code,  use  the
  VALUE   reserved   word   in  either  TYPE  definitions  or  VAR
  declarations.) The exact form of an  initialization  depends  on
  the type of the variable being initialized.

  Syntax:

     VALUE
        {variable-identifier := constant-expression};...

  The 'variable-identifier' is the name  of  the  variable  to  be
  initialized.    You   can  initialize  a  variable  or  variable
  component  only  once  in  the  VALUE  section.   Any  variables
  appearing  in  the  VALUE  section must appear in a previous VAR
  section.

  The 'constant-expression' is any  constant  expression  that  is
  assignment compatible with the variable identifier.

  Unlike other declaration sections, the VALUE section can  appear
  only in a program or module declaration section.  You cannot use
  the VALUE declaration section in procedures  or  functions.   If
  you  wish  to  initialize variables in procedures and functions,
  use an initial-state specifier (by using the VALUE reserved word
  in either the TYPE or VAR section).

  You can assign values to complete structured variables or  to  a
  single component of that variable.

  Example:
     VAR
        School : Record
           Class : Record
              Grades : Char;
              Order  : Integer;
              End;
           Passed : Boolean;
           End;

     VALUE
        School := (('B', 14), TRUE);

  The constructor of School specifies  a  constant  value  of  the
  correct type for each field in the record.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.