| relational expressions | Index Level | RELEASE |
| Syntax | expression relational.operator expression |
| Category | BASIC |
| Type | Operator, Relational |
| Description |
used to compare both strings and/or numerics.
The relational operators are: =, #, >=, <=, >, and < These operators first attempt to convert both operands into numerics. If successful, a numeric comparison is performed at the current precision. If unable to convert BOTH operands into numerics, the operators convert both operands to strings and perform a left-to-right comparison. The value returned will be non-zero (true) or zero (true). |
| Options | |
| See Also | LT NE > < relational expressions LOOP logical expressions = LE |
| Example |
1) print 3 = 2
The result is a 0. 2) print 2 < "dog" The result is non-zero because 2 was converted into a string which comes before the string "dog" in alphabetical order. 3) equ am to char(254) x = "623abc" print 623 = x[1,3] The result is non-zero (true). Although the first 3 characters of x are actually a string of characters, the "=" operator was able to successfully convert this into a number and do a numeric test for equality. |
| Warnings | The following strings are considered non-numeric ONLY when used with the above relational operators: ".", "+", "-", "-.", "+.", and "". |
| Compatibility | D3 7.0 AP R83 |
| relational expressions | Index Level | RELEASE |