Arithmetic Operators
- Used to perform mathematical tasks
Operator | Name | Description |
---|---|---|
+ | Addition | Adds two values |
- | Subtraction | Subtracts one value from another |
* | Multiplication | Multiplies two values |
/ | Division | Divides one value by another |
% | Modulus | Returns the division remainder |
++ | Increment | Increases the value of a variable by 1 |
- | Decrement | Decreases the value of a variable by 1 |
Assignment Operators
- Used to assign values to variables
Logical Operator
- Used to test for True or False
- Used to determine the logic between the values or variables
Operator | Name | Description | Example |
---|---|---|---|
&& | Logical and | Returns true if both statements are true | x < 5 && x < 10 |
| | Logical or | Returns true if one of the statements is true | x < 5 | x < 4 |
! | Logical not | Reverse the result, returns false if the result is true | !(x < 5 && x < 10) |
Comparison Operator
- Used to compare two values
- The return values of a comparison is either True or False