Introduction
A programming operator is a symbol that represents an action or process. In programming, operator are constructs defined within programming that behaves like functions.
Programming Operator is special symbols that which cause to perform certain functionality. Most of the programming languages, such as python, java, c, c#, javascript…etc. uses operator. Operators are used in programs to manipulate data and variables. Programming operator are the backbone of a program and they are used while performing simple functions related to arithmetic or logical. Programming operator separate identifiers in an expression. The programming operator act upon data items (variable, constants). The data item upon which the operations is performed are called operands.
Types of programming operator
- Arithmetic Operator
- Relational Operator
- Logical Operator
- Assignment Operator
- Increment/Decrement Operator
Arithmetic Operator
Arithmetic operators are used for performing mathematical calculations. We can write a program for performing calculations like a calculator. Check the table below.
Operator | Description |
+ | Add two number |
– | Subtract two number |
* | Multiply two number |
/ | Divide two number |
% | Modular division |
Relational Operator
These operator provides the relationship between two expressions.
Operator | Description |
== | Checks if the value of two operands are equal |
!= | Checks if the value of two operands are equal or not |
> | Check if the value is greater |
< | Checks if the value is smaller |
>= | Checks if the values is greater or equal |
<= | Checks if the value is smaller or equal |
Logical Operator
This operator checks the logical relationship between two expressions. The conditions provide logical true of false status after checking.
Operator | Description |
|| | Logical OR, Check if at least one of the operand is true |
&& | Logical AND, Checks at least one of the operator is false |
! | Logical NOT, Checks if the operand is false |
Assignment Operator
An assignment operator is used for assigning the result of an expression to a variable. The symbol of assignment operator is ( = ).
Operator | Description |
= | Used to assign a value from right side operand to left side operand |
+= | Store the sum of both the operands to the left side operand. |
-= | Store the difference of both the operands to the left side operand. |
*= | store the multiplicaton of both the operands to the left side operand. |
/= | Store the division of both the operands to the left side operand. |
%= | To store the remainder of both the operands to the left side operand. |
Increment/Decrement Operator
Increment and decrement operator is often in performing looping. It either increases the value by one or decreases value by 1.
Operator | Description |
+ + | Increment by 1 |
– – | Decrement by 1 |