DEV Community

pranavinu
pranavinu

Posted on

OPERATOR

Operator:
1)Operator is to perform an opreation on variables and values
2)It is a symbol,it performs an opreation ike(add,sub,..etc)
3)It has a 5 types of operator

Types of operator:
1)Aritmetic operator
2)Assignment operator
3)Relational operator
4)Unary operator
5)Conditional operator

Arithmetic operator:
1)It performs an maths operation in between the values
2)It has an operators like (+,-,*,/,%)

  • operator-It add the two values
  • operator-It sub the two values
  • operator-It multiply the two values % operator-It gives the reminder values / operator-It gives the quotient values

Assignment operator:
1)It has only (=) operator
2)It is to assign the values to variable

Relational operator:
1)It is to compares the two values
2)It always gives an boolean values
3)It has an operators like(==,!=,<,>,<=,>=)

== operator-It is to check,the first value and second values are same
!= operator-It is to check the first value and second values are different
< operator-It is to check the first value is smaller then the second values

operator-It is to check the first value is greater then the second values
<= operator-It is to check the first value is smaller then or equal to the second values
= operator-It is to check the first value is greater then or equal to the second values

Unary operator:
1)it is to increment(++) or decrement(--) a value by 1

value++ post increment-At first,it uses the value then it will increase the value by1
++value pre increment-At first,it will increase the value by 1 and then
it uses the value
--value pre decrement-At first,it will decrease the value by 1 and then
it uses the value
value-- post decrement-At first,it uses the value then it will decrease the value by1

Top comments (0)