| .BASIC Relational Operators. |
|
  Expressions and Operators    Relational Operators    Contents    Index |
| ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ |
| Relational Operators |
|   |
| Relational operators are used to compare two values. The result of the |
| comparison is either "true" (nonzero) or "false" (zero). This result can |
| then be used to make a decision regarding program flow. Although BASIC |
| treats any nonzero value as true, true is usually represented by -1. |
|   |
|   Operator        Relation                    Expression |
|       =           Equality                    X = Y |
|       <>          Inequality                  X <> Y |
|       <           Less than                   X < Y |
|       >           Greater than                X > Y |
|       <=          Less than or equal to       X <= Y |
|       >=          Greater than or equal to    X >= Y |
|   |
| When arithmetic and relational operators are combined in one expression, the |
| arithmetic operations are always done first. For example, the following |
| expression is true if the value of X + Y is less than the value of (T - 1)/Z: |
|   |
|   X + Y < (T - 1) / Z |
|   |
| Be careful using relational operators with single- and double-precision |
| values. Calculations may give extremely close but not identical results. In |
| particular, avoid testing for identity between two values. For example, the |
| PRINT statement in the following IF statement is not executed unless A! is |
| exactly equal to 0.0: |
|   |
|   IF A! = 0.0 THEN PRINT "Exact result." |
|   |
| When A! is an extremely small value, for example 1.0E-23, the PRINT |
| statement is not executed. |