Automatic Type Conversions - 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

When you create an expression involving data of different types, MapInfo performs automatic type conversion in order to produce meaningful results. For example, if your program subtracts a Date value from another Date value, MapBasic will calculate the result as an integer value (representing the number of days between the two dates).

The table below summarizes the rules that dictate MapBasic's automatic type conversions. Within this chart, the keyword Integer represents an integer value, which can be an integer variable, a SmallInt variable, or an integer constant. The keyword Number represents a numeric expression which is not necessarily an integer.

Operator Combination of Operands Result

+

Date + Number

Date

Number + Date

Date

Integer + Integer

Integer

Number + Number

Float

Other + Other

String

-

Date - Number

Date

Date - Date

Integer

Integer - Integer

Integer

Number - Number

Float

*

Integer * Integer

Integer

Number * Number

Float

/

Number / Number

Float

\

Number \ Number

Integer

MOD

Number MOD Number

Integer

^

Number ^ Number

Float