Comparison Operators - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

The comparison operators compare two items of the same general type to produce a logical value of TRUE or FALSE. Although you cannot directly compare numeric data with non-numeric data (e.g., string expressions), a comparison expression can compare integer, SmallInt, and float data types. Comparison operators are often used in conditional expressions, such as If...Then.

Operator Returns TRUE if: Example

=

a is equal to b

a = b

<>

a is not equal to b

a <> b

<

a is less than b

a < b

>

a is greater than b

a > b

<=

a is less than or equal to b

a <= b

>=

a is greater than or equal to b

a >= b

The Between...And... comparison operator lets you test whether a data value is within a range. This operator is inclusive (for example, X >= 500 And X <= 600). It works with string and date types as well as with numeric values, and it can be used in a WHERE clause in a SQL query. The following If...Then statement uses a Between...And... comparison:

If x Between 0 And 100 Then 
				Note "Data within range." 
			Else 
				Note "Data out of range." 
			End If