!= # Not equal

 


 <> != #
 Not equal--binary                               (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> <> <exp2>
     <exp1> != <exp2>
     <exp1> #  <exp2>

 Type

     Character, date, logical, memo, NIL, numeric

 Operands

     <exp1> and <exp2> are expressions of the same data type or NIL
     to be compared for inequality.

 Description

     The not equal ( <>) operator compares two values of the same data type
     and returns true (.T.) if <exp1> is not equal to <exp2> according to the
     following rules:

     .  Character:  The comparison is based on the underlying ASCII
        code and is the inverse of the equal operator (=).  This means that
        the comparison is sensitive to the current EXACT SETting.  See the
        examples below.

     .  Date:  Dates are compared according to the underlying date
        value.

     .  Logical:  False (.F.) is not equal to true (.T.).

     .  Memo:  Treated the same as character.

     .  NIL:  All values compared to NIL other than NIL return true
        (.T.).

     .  Numeric:  Compared based on magnitude.

 Examples

     .  These examples illustrate how the not equal operator (<>)
        behaves with different data types:

        // Character
        SET EXACT ON
        ? "123" <> "12345"         // Result: .T.
        ? "12345" <> "123"         // Result: .T.
        ? "123" <> ""              // Result: .T.
        ? "" <> "123"              // Result: .T.
        SET EXACT OFF
        ? "123" <> "12345"         // Result: .T.
        ? "12345" <> "123"         // Result: .F.
        ? "123" <> ""              // Result: .F.
        ? "" <> "123"              // Result: .T.

        // Date
        ? CTOD("12/12/88") <> ;
           CTOD("12/12/88")        // Result: .F.

        // Logical
        ? .T. <> .T.               // Result: .F.
        ? .T. <> .F.               // Result: .T.

        // NIL
        ? NIL <> NIL               // Result: .F.
        ? NIL <> 12                // Result: .T.
        ? NIL <> "hello"           // Result: .T.

        // Numeric
        ? 2 <> 1                   // Result: .T.
        ? 1 <> 1                   // Result: .F.

See Also: $ < <= = (equality) == > >=

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.