Comparing different data types

The expressions on both sides of a comparison operator must conform to the same data type or at least compatible data types. You cannot compare a string to a numeric data type, e.g. "one" with 1. They are stored differently in the computer, and if you try, you will get a type mismatch error. You can compare any numeric data type against any other numeric data type most of the time. In other words, you can test whether a single-precision value is less than or greater than an integer value, such as 100 >99.99. Clearly, this comparison would return the result True.

0 0

Responses

Post a comment