xHarbour Reference Documentation > Operator Reference |
Greater than operator (binary): compares the size of two values.
<Expression1> > <Expression2>
The "greater than" operator compares two values of the same data type. It returns .T. (true) when the left operand is greater than the right operand, otherwise the return value is .F. (false).
Only the simple data types Character, Data, Logic, Memo and Numeric can be compared. The complex data types Array, Code block, Hash, Object and the value NIL cannot be used with the "greater than" operator.
Comparison rules
Data type | Comparison |
---|---|
Character | The comparison is based on the ASCII value of the characters. |
Date | The comparison is based on the underlying date value. |
Logical | False (.F.) is smaller than true (.T.). |
Memo | Same as Character data type. |
Numeric | Comparison is based on the value of the numerics. |
SET EXACT
For character comparisons, the greater than operator takes the SET EXACT setting into account. With SET EXACT OFF, characters are compared up to the length of the right operand. With SET EXACT ON, characters are compared up to the length of the left operand and trailing blank spaces are ignored.
See also: | $, <, <=, <> != #, = (comparison), ==, >=, SET EXACT |
Category: | Comparison operators , Operators |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates the result of the ">" operator. PROCEDURE Main ? "A" > "Z" // result: .F. ? "a" > "Z" // result: .T. ? CToD("12/28/2005") > CToD("12/31/2005") // result: .F. ? .T. > .F. // result: .T. ? 2 > 1 // result: .T. SET EXACT OFF ? "ab" > "a" // result: .F. SET EXACT ON ? "ab" > "a" // result: .T. RETURN
http://www.xHarbour.com