Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - == equality operator (relational) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ==                  Equality operator (relational)
------------------------------------------------------------------------------
 Syntax
   <expr1> == <expr2>

 Arguments
   <expr1> is an expression to compare with <expr2>.

   <expr2> is an expression to compare with <expr1>. Both expressions must
   be of the same data type.

 Description
   The == operator yields a value of either .t., if the two operands
   have the same value; or .f. if the expressions evaluate to different
   values.

   When applied to character values, the == operator performs an exact
   comparison, i. e. the result will only be .t. if both compared character
   values have the same length and contain the same characters (including
   leading and trailing spaces). In contrast with the equal to (=) operator,
   the identical to (==) operator does not respect the current status of the
   set exact flag.

   When used with non-char values, the == operator performs identically to
   the = operator. In such cases, however, the use of == is preferred, to
   avoid any possibility of confusion with the identically formed obsolete
   assignment operator (=).

 Example
   #define EXAMPLE_OPERATOR
   #include example.hdr

   proc Test_927
   
   // numeric
   ? 1 == 1                         // prints .T.
   ? 1 == 2                         // prints .F.
   
   // date
   ? today() == today()             // prints .T.
   ? today() == ctod( "12/31/99" )  // generally prints .F.
   
   // logical
   ? .t. == .t.                     // prints .T.
   ? .t. == .f.                     // prints .F.
   ? .f. == .f.                     // prints .T.
   
   // character
   set exact off
   ? "Hello" =  ""                  // prints .T.
   ? "Hello" == ""                  // prints .F.
   ? "Hello" =  "Hel"               // prints .T.
   ? "Hello" == "Hel"               // prints .F.
   
   endproc
   

   proc main
   Test_927()
   endproc

See Also: =

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson