Page 26 - tp_Modula_v2.0
P. 26

Example
                   Operator       Name                     Description                                      Output
                                                                                         (x=8 and y=6)
                       !=       Not equal It checks if the values of two operands             x != y       TRUE
                                            are  equal or not. If the values are  not

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

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

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


                  Program 4: To show all the relational operators’ functions.

                      Program4.py
                   File  Edit  Format   Run   Options  Window    Help

                   #examples of relational operators
                   a= 11
                   b= 32

                   #check if a is greater than b
                   print(a > b)

                   #check if a is less than b
                   print(a < b)

                   #check if a is equal to b
                   print(a == b)
                   #check if a is not equal to b
                   print(a != b)

                   #check if a is greater than equal to b
                   print(a >= b)

                   #check if a is less than equal to b
                   print(a <= b)




                   24     Touchpad MODULAR (Version 2.0)
   21   22   23   24   25   26   27   28   29   30   31