qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Dec and Inc Procedures
  Summary Details Example                                   Back
 
  Arguments
 
    variable               Variable of any ordinal type
 
    increment/decrement    Optional; integer expression specifying
                           the increment or decrement amount (default
                           is 1)
 
  Description
 
    The Inc procedure increases an ordinal variable by a given integer
    value. The Dec procedure decreases an ordinal variable by the
    given value. If no increment or decrement is specified, the amount
    of the increment or decrement is 1.
 
    The new value is the value of the variable plus the increment or
    minus the decrement within the list of values for the ordinal type
    of the variable. An ordinal type can be a subrange, a predefined
    type, or a user-defined enumerated type.
 
      Argument Type                  Example Call     New Argument Value
      ════════════════════════════   ═════════════    ══════════════════
      Boolean, x = False             Inc( x )         True
      Any integer type               Inc( x, 3 )      x+3
      Char, ch = 'A'                 Inc( ch, 32 )    'a'
      Wkdy = Mon, in an enumerated   Inc( Wkdy )      Tue
      type Days=(Mon,Tue,Wed)
 
      Argument Type                  Example Call     New Argument Value
      ════════════════════════════   ═════════════    ══════════════════
      Boolean, x = True              Dec( x )         False
      Any integer type               Dec( x, 3 )      x-3
      Char, ch = 'a'                 Dec( ch, 32 )    'A'
      Wkdy = Wed, in an enumerated   Dec( Wkdy )      Tue
      type Days=(Mon,Tue,Wed)
 
    The following increments are logically equivalent:
 
       Inc( variable );
    or
       variable := Succ( variable );
    or
       variable := variable + 1;
 
    The following decrements are logically equivalent:
 
       Dec( variable );
    or
       variable := Pred( variable );
    or
       variable := variable - 1;
 
    The Inc and Dec statements produce the fastest code in these
    examples.
 
    If the first element in the range is decremented or the last is
    incremented, a range error occurs. When {$R+} is set, a range error
    causes the program to halt with a run-time error.