qck.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Relational Operators
                                                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Relational Operators
 
 ■ Relational operators are used to compare two values. The result of a
   comparison is either "True" (nonzero) or "False" (zero). This result can
   then be used to make decisions regarding program flow. Although Visual
   Basic treats any nonzero value as True, relational operators always return
   -1 for True.
 
   Operator       Relation                       Expression
   ════════       ════════════════════════       ═══════════════════════════
   =              Equality(1)                    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
   ─────────────────────────────────────────────────────────────────────────
   (1) The equal sign (=) is also used to assign a value to a variable.
       See: LET Statement
 
 ■ 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 equality 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.
 
 ■ A compiled program (.EXE file) that compares single- and double-precision
   values may give different results than the same program run in the
   programming environment. See: Compiled Programs
 
 See: Expressions and Operators Summary