Page 62 - iPlus_Ver_2.0_class_8
P. 62

Example
                     Operator                  Description                   Syntax                         Output
                                                                                       (int a = 11, b = 4)
                        !=        This operator is  used to check the  (a != b)        a != b               true
                   Not Equal to inequality between two values.                         a != 11              false

                         >        This operator checks if the first value  (a > b)     (11 > 2)             true
                   Greater than is greater than the second value.                      (11 > 13)            false
                         <        This operator is used to check if the  (a < b)       (15 < 5)             false

                     Less than    first value is less than the second value.           (15 < 20)            true
                        >=        This operator is used to check if the  (a >= b)      (22 >= 22)           true
                   greater than  first value is greater than or equal to               (22 >= 19)           true
                     or equal     the second value.
                                                                                       (21 >= 23)           false
                        <=        This operator is used to check if the  (a <= b)      (27 <= 27)           true
                   less than or  first value is less than or equal to the              (30 <= 31)           true
                     equal to     second value.
                                                                                       (29 <= 25)           false

                  Logical Operators

                  Logical operators are used to combine multiple conditions and evaluate them. They return a
                  Boolean value ‘True’ or ‘false’ as result.


                   Operator            Description                Syntax                Example             Output

                   && (AND) Returns ‘true’ value if all the  (a>b) && (b>c) (11 > 4) && (4 > 15)           false
                               given conditions are true.                       (11 > 4) && (15 > 4)       true
                   || (OR)     Returns  ‘true’  value if any  (a>b) || (b>c)    (11 > 4) || (4 > 15)       true
                               one of the given conditions                      (11 > 4) || (15 > 4)       true

                               is true.                                         (4 > 11) || (4 > 15)       false
                   NOT (!)     Returns  ‘true’  value  if the  ! (a > b)        !(11 > 4)                  false
                               condition returns false and                      !(4 > 11)                  true
                               vice-versa.
                  Unary Operators

                  Unary  operators are  special operators  that  require only one operand  or value to perform

                  operations. Increment and decrement are the examples of unary operators.
                                                                                        Example
                   Operator                   Description                   Syntax                        Output
                                                                                     (int a = 11, b = 0)
                       ++       Returns the incremented value as result.     a ++        b = a++         a=12 b=11
                   increment
                       --       Returns the decremented value as result.      a --        b = a--        a=10 b=11
                   decrement






                    60
                         iPlus (Ver. 2.0)-VIII
   57   58   59   60   61   62   63   64   65   66   67