Navigation: thinBasic language > Operators > Comparison > Comparison Operators |
|
Description
Used to compare expressions.
Syntax
result = expression1 comparisonoperator expression2
Comparison operators have these parts:
Part | Description |
result | Any numeric variable. |
expression1 | Any expression. |
comparisonoperator | Any comparison operator. |
expression2 | Any expression. |
Returns
Number
Remarks
The following table contains a list of the comparison operators and the conditions that determine whether result is True, False.
Operator |
Description |
True if |
False If |
< |
Less than |
expression1 < expression2 |
expression1 >= expression2 |
<= or =< |
Less than or equal to |
expression1 <= expression2 |
expression1 > expression2 |
> |
Greater than |
expression1 > expression2 |
expression1 <= expression2 |
>= or => |
Greater than or equal to |
expression1 >= expression2 |
expression1 < expression2 |
= |
Equal to |
expression1 = expression2 |
expression1 <> expression2 |
<> |
Not equal to |
expression1 <> expression2 |
expression1 = expression2 |
When comparing two expressions, you may not be able to easily determine whether the expressions are being compared as numbers or as strings. thinBasic performs internal conversions in order to determine correct values. In general it will mostly depend from what is expected.
For example:
• | if a string expression is expected, comparison will take place comparing strings. All numbers or number returned by functions calling will be converted to strings; |
• | if a numeric expression is expected, comparison will take place comparing numbers. All strings or strings returned by functions calling will be converted to numbers; |
Restrictions
See also
Examples
© 2004-2008 thinBasic. All rights reserved. | Version 1.7.0.0 | Web Site: http://www.thinbasic.com |