Chapter 8 Operators and Expressions
Chapter 8 Operators and Expressions
Unary Operators:
+ Unary Plus
- Unary Minus
~ Bitwise Compliment
not Logical Negation
OPERATORS
Binary Operators:
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder or Modulus
** Exponent.
// Floor Division
OPERATORS
Binary Operators:
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder or Modulus
** Exponent.
// Floor Division
OPERATORS
Bitwise Operators:
Shift Operators:
Relational Operators:
Exponent
Floor
Division
BITWISE OPERATORS EXAMPLE
BITWISE AND & EXAMPLE
BITWISE AND & OPERATOR EXAMPLE
& operator picks bits exists in both the
operands (common)
BITWISE
AND
OPERATOR
BITWISE OR | EXAMPLE
BITWISE OR | OPERATOR EXAMPLE
| operator picks bits exists in either the
operands ( any one or both )
BITWISE OR
| OPERATOR
BITWISE OR EXCLUSIVE ^ EXAMPLE
BITWISE EXCLUSIVE OR ^ OPERATOR EXAMPLE
It picks up bit if it is one operand not in both
(uncommon)
BITWISE ^
OPERATOR
SHIFT OPERATORS EXAMPLE
BITWISE ONE’s COMPLIMENT
~ OPERATOR EXAMPLE
BINARY ONE’s COMPLIMENT ~ OPERATOR EXAMPLE
OPERATOR EXAMPLE
BINARY << LEFT SHIFT EXAMPLE
The first operand’s value is moved left by the
number of bits specified by the second operand.
<< BINARY RIGHT SHIFT
OPERATOR EXAMPLE
BINARY >> RIGHT SHIFT EXAMPLE
The first operand’s value is moved right by the
number of bits specified by the second operand.
Assignment Operators
OPERATORS
Assignment Operators:
= Assignment Operator
*= Assign Product
/= Assign Quotient
+= Assign Sum
-= Assign Minus
%= Assign Remainder
**= Assign Exponent
//= Assign Floor Division.
DIFFERENT ASSIGNMENT
STATEMENT EXAMPLE
BINARY >> RIGHT SHIFT EXAMPLE
OPERATORS
Membership Operators:
EXAMPLE
MEMBERSHIP OPERATOR EXAMPLE
CLASS TEST
CLASS TEST