guides:programming:programmers_reference_manual:comparison_operators

Comparison operators

Use comparison operators to compare to values or expressions.

expression operator expression

The following table describes the available comparison operators in BASIC+:

OperatorDescription
= or EQEqual
# or NENot equal
< or LTLess than
⇐ or LELess than or equal
> or GTGreater than
>= or GEGreater than or equal
_EQCEqual, case-insensitive
_NECNot equal, case-insensitive
_LTCLess than, case-insensitive
_LECLess than or equal, case-insensitive
_GTCGreater than, case-insensitive
_GECGreater than or equal, case-insensitive
MATCH or MATCHESTests if the expression on the left matches the pattern on the right
_EQXEqual, to full precision
_NEXNot equal, to full precision
_LTXLess than, to full precision
_GTXGreater than, to full precision
_LEXLess than or equal, to full precision
_GEXGreater 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.).

All comparison operations result in a boolean value of either 1 (true) or 0 (false).

if "hello" _NEC "HELLO" then
  Msg(@window, "There is something very wrong")
end
  • guides/programming/programmers_reference_manual/comparison_operators.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1