[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 -
 Subtraction, unary negative, concatenation  (Math, Character)
------------------------------------------------------------------------------
 Syntax

     <nNumber1> - <nNumber2>             (subtraction)
     <dDate1>   - <dDate2>               (subtraction)
     <dDate>    - <nNumber>              (subtraction)
     <cString1> - <cString2>             (concatenation)

 Type

     Character, date, memo, numeric

 Operands

     <nNumber1> is a numeric value to decrement by <nNumber2>.

     <dDate1> is a date value to decrement by <dDate2>.

     <dDate> is a date value to decrement by <nNumber> days.

     <cString2> is a character string to join to the end of
     <cString1> after trimming the trailing blanks from <cString1>.

 Description

     The (-) operator performs different operations depending on the data
     types of the operands:

     .  Unary negative sign (numeric): A numeric expression prefaced
        with the minus (-) operator performs the equivalent of multiplying
        the operand by (-1), returning a negative numeric value.

     .  Binary subtraction (numeric, date): If both operands are
        numeric data type, <nNumber2> is subtracted from <nNumber1> and the
        result is returned as a numeric value.  If both operands are date
        data type, <dDate2> is subtracted from <dDate1> and the result is
        returned as a numeric value representing the number of days between
        the two dates.  If the left operand is date data type and the right
        operand numeric data type, the <nNumber> is subtracted as days from
        <dDate> and a date value is returned.  If the order of operands is
        reversed, a runtime error occurs.

     .  Concatenation (character, memo):  If both operands are
        character data type, <cString2> is joined to <cString1>, returning a
        character string. Trailing blanks are trimmed from <cString1> and
        joined to the end of the return string.

 Examples

     .  These examples illustrate the various forms of the - operator:

        // Binary subtraction (numeric)
        ? 1 - 1                           // Result: 0
        ? 1 - 0                           // Result: 1
        ? 0 - 1                           // Result: -1

        // Binary subtraction (date)

        ? CTOD("12/12/88") - 12         // Result: 11/30/88
        ? 12 - CTOD("12/12/88")         // Result: Runtime error

        // Concatenation (character)
        ? "Hi " - "There" + "*"         // Result: Hithere *


See Also: % * ** + / = (compound)
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson