Operator > Foundation

Greater than operator (binary): size comparison of two values.

<Expression1> > <Expression2>
<Expression1> and <Expression2> are expressions with the same data type whose values are to be compared.

The greater than operator compares two values of the same data type and returns the result of the comparison as a logical value. The result is .T. (true) only when <Expression1> is larger than <Expression2>. Otherwise it is .F. (false).

Values of data type array, code block, object or NIL cannot be compared using this operator. A value with data type memo is handled like a value with data type character.

Comparison of characters

The settings of SET EXACT ON | OFF and SET LEXICAL ON | OFF are taken into account in comparing characters or character strings (see example). When SET LEXICAL is set to OFF, characters are compared with each other based on the collation table specified via the SET COLLATION command.

With SET EXACT OFF, the characters are compared up to the length of the right character string <Expression2>. With SET EXACT ON, the characters are compared up to the length of the left character string <Expression1> and trailing blanks are not considered. If <Expression2> contains a null string (""), the greater than operator always returns the value .F. (false) if SET EXACT OFF (unless both operands contain a null string), and .T. (true) with SET EXACT ON.

The setting SET LEXICAL ON has precedence over SET EXACT ON. With SET LEXICAL ON, character comparison are based on the country specific lexical character values defined by the operating system. The lexical value of one or more characters can be redefined using the function SetLexrule().

Comparison of date values

Values with data type date are compared with each other on a chronological basis.

Comparison of logical values

The value .T. (true) is larger than the value .F. (false).

Comparison of numeric values

A comparison is based on the sizes of the numeric values.

The greater than operator (>)
// This example illustrates the results of the greater than operator 
// with various comparison expressions. 
// The examples containing strings show the effects of 
// SET EXACT and SET LEXICAL on the comparison. 

                                    // character value 
   ? "A"  > "Z"                     // result: .F. 
   ? "A"  > "A "                    // result: .F. 
   ? "A " > "A"                     // result: .F. 
   ? ""   > "A"                     // result: .F. 
   ? "A"  > ""                      // result: .F. 
   ? "AB" > "ABC"                   // result: .F. 
   ? "ABC"> "AB"                    // result: .F. 


   ? "A"  > "Z"                     // result: .F. 
   ? "A"  > "A "                    // result: .F. 
   ? "A " > "A"                     // result: .F. 
   ? ""   > "A"                     // result: .F. 
   ? "A"  > ""                      // result: .T. 
   ? "AB" > "ABC"                   // result: .F. 
   ? "ABC"> "AB"                    // result: .T. 

   SetLexrule( "ß", "ss" )          // "ß" translates to "ss" 
   ? "groß" > "gross"               // result: .T. 

   ? "groß" > "gross"               // result: .F. 

   ? CtoD("12/31/94") > ;           // date value 
     CtoD("01/01/95")               // result: .F. 

                                    // logical value 
   ? .T. > .F.                      // result: .T. 

                                    // numeric value 
   ? 5 > 10                         // result: .F. 
   ? 10 > 5                         // result: .T. 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.