Description
Use comparison operators to compare to values or expressions.
Parameters
expression operator expression
The following table describes the available comparison operators in BASIC+:
| Operator | Description |
|---|---|
| = or EQ | Equal |
| # or NE | Not equal |
| < or LT | Less than |
| <= or LE | Less than or equal |
| > or GT | Greater than |
| >= or GE | Greater than or equal |
| _EQC | Equal, case-insensitive |
| _NEC | Not equal, case-insensitive |
| _LTC | Less than, case-insensitive |
| _LEC | Less than or equal, case-insensitive |
| _GTC | Greater than, case-insensitive |
| _GEC | Greater than or equal, case-insensitive |
| MATCH or MATCHES | Tests if the expression on the left matches the pattern on the right |
| _EQX | Equal, to full precision |
| _NEX | Not equal, to full precision |
| _LTX | Less than, to full precision |
| _GTX | Greater than, to full precision |
| _LEX | Less than or equal, to full precision |
| _GEX | Greater than or equal, to full precision |
Note: For purposes of comparison, any value less than 0.000005 is considered to be zero. For example, the expression:
If 0.00000499 = 0.00000123
will evaluate to true. The five digits of precision are decimal places, not simply the four most significant digits of a number.
You can compare values having more than 5 decimal places, by using the comparison operators ending in "X" (_eqx, _nex, etc.).
Returns
All comparison operations result in a boolean value of either 1 (true) or 0 (false).
See also
If statement, Loop statement, MATCHES operator
Example
if "hello" _NEC "HELLO" then Msg(@window, "There is something very wrong") end