Assignment Operator
= (equals to)
These operator used to compare two expression, the result can only be true or false.
= (equals to)
This operator is used to assign value to a variable.
e.g. a = 5;
In this case the variable a assigned by the value 5.
Arithmetic Operators
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| % | Modulo |
The first four operators works same as they work in mathematics.
% is used to find the remainder but it can't be used for decimal value.
e.g.
4%3=1
8%2=0
but in case when nominator will be greater than denominator then it will return the nominator.
e.g.
3%4=3
2%5=2
Relational Operator
| < | Greater than |
| <= | Greater than equal to |
| > | Less than |
| >= | Less than equal to |
| = = | Equal to equal to |
| != | Not equal to |
These operator used to compare two expression, the result can only be true or false.
e.g.
| 3<1 | false |
| 3<=3 | true |
| 3>6 | true |
| 7>=7 | true |
| 8= =9 | false |
| 9!=10 | true |
Logical Operators
| && | AND | All the conditions must be true |
| || | OR | Any single conditions must be true |
| ! | NOT | Evaluates the opposite boolean value |
e.g.
| (5 = = 5 )&& (8>4) | True |
| (9 = = 7) || (9>7) | True |
| ! (4 = = 3) | True |



No comments:
Post a Comment