Page 138 - Trackpad_V1_Book 7_Flipbook
P. 138

Relational Operators or Comparison Operators
                  These operators are used to compare two values to one another.


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



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

                                                   It checks if the values of two
                                                   operands are equal or not. If
                          !=          Not equal                                          x != y             TRUE
                                                   the values are not equal, then
                                                   the condition becomes true.


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


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


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


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



                  Logical Operators
                  These operators are used to make decisions on two conditions. Logical Operators are used with
                  boolean values and return boolean values as output.





                  136   Trackpad (Version 1.0)-VII
   133   134   135   136   137   138   139   140   141   142   143