Page 101 - TechPluse_C6_Flipbook
P. 101

Example
                  Operator       Name        Description                                                     Output
                                                                                            (x=4 and y=2)
                      /         Division     Divides left hand operand by right hand             x / y          2
                                             operand.
                     ^        Exponential    Performs exponential (power) calculations           x ^ y         16
                                             on operands.


                 Program 3: To use the arithmetic operators.






















                 Logical Operators

                 Logical operators are used primarily in the expression evaluation to make a decision. BASIC-256
                 supports the following logical operators:

                                                                                     Example (x=3 and
                  Operator Name Description                                                                 Output
                                                                                             y =7)
                     and       AND  It returns true, if both operands are true.      (x < 5) and (y < 10)    TRUE
                      or        OR    It returns true, if one of the operands is true. (x < 5) or (y < 2)    TRUE

                     not       NOT    Reverses the logical state of its operand.     NOT x                   FALSE
                     xor       XOR    Performs a logical exclusion on two            x XOR y                 FALSE
                                      expressions.


                 Program 4: To use the logical operators.






















                                                                                     Introduction to BASIC-256       99
   96   97   98   99   100   101   102   103   104   105   106