Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 101 - 2505_CoreGPT(Podar)_Flipbook_C6
P. 101

    Relational Operators

                     Relational operators are used to compare the values of two operands and returns Boolean true
                     or false accordingly. The comparison operators are described in the following table:

                                                                                                   Example
                      Operator Name          Description                                           (x=8 and  Output
                                                                                                     y=6)

                                             It checks if the values of two operands are equal
                          =      Equal                                                               x = y       FALSE
                                             or not. If yes, then the condition becomes true.

                                             It checks if the values of two operands are equal
                                 Not
                         <>                  or not. If the values are not equal the condition      x <> y       TRUE
                                 equal
                                             will become true.
                                             It checks if the value of left operand is greater
                                 Greater
                          >                  than the value of right operand. If yes, then the       x > y       TRUE
                                 than
                                             condition becomes true.
                                             It checks if the value of left operand is less
                          <      Less than than the value of right operand. If yes, then the         x < y       FALSE
                                             condition becomes true.

                                 Greater     It checks if the value of left operand is greater
                         >=      than or     than or equal to the value of right operand. If         x >= y      TRUE
                                 equal to    yes, then the condition becomes true.

                                 Less than  It checks if the value of left operand is less than
                         <=      or equal    or equal to the value of right operand. If yes,         x <= y      FALSE
                                 to          then the condition becomes true.

                     Program 5: To use the relational operators.

                                                                                         Introduction to BASIC-256       99

| 96 97 98 99 100 101 102 103 104 105 106 |