Table of content

Operators

Operators are nothing but symbols that indicates the operations which are to be performed. Operators tell the compiler which logical or mathematical operations, should be carried out. There are five different types of operators found in the Arduino Programming.

They are :

  • Arithmetic Operators
  • Comparison Operators
  • Boolean Operators
  • Bitwise Operators
  • Compound Operators
Arithmetic Operators:

There are six different types of Arithmetic Operators in Arduino. They are:

  • Assignment Operators : Assignmentment Operators are used for storing the value right to the operator into the value left to the operator. For example in the code, value1= value2; value2 will be copied to value1. The operator is denoted by an equal sign(=).
  • Addition Operator : Addition operator is used to dd any two operands. This operator is denoted by a plus sign(+). For example, in the code value1+value2, both the values are added.
  • Subtraction Operator : Subtraction Operator is used for subtracting one value from the other. This operator is denoted by a minus sign(-). The right side value is subtracted from the left side value. For example in the code, value1-value2, the value2 is subtracted from the value1.
  • Multiplication Operator : Multiplication Operator is used for multiplying two operands. This operator is denoted by a multiplication sign(*). For example in the code, value1*value2, both the values will get multiplied.
  • Division Operator: Division Opetaror is used to divide the first value by the second. This operator is denoted by the divide sign(/). For example in the code, value1/value2, will divide the value1 by value2.
  • Modulo Operator : The Modulo Operator is used to find the remainder after performing division between any two operands. For example, value1 is 10 and value2 is 4. Now, if we perform value1%modulo2, then the result will be 2. This is because, when 4 divides 10, the remainder is 2.
Comparison Operators:

There are six different types of Comparison Operators in Arduino. They are:

  • equal to : This operator checks whether the value of two operands is equal. This operator is denoted by equal-equal sign(==).
  • not equal to : This Operator checks whether the value of the two operands are not equal. This operator is denoted by not-equal to(!=).
  • less than : This operator checks whether one value is less than the other. This operator is denoted by the less-than sign(<).
  • greater than : This operator checks whether one value is greater than the other. This operator is denoted by greater-than sign(>).
  • less than or equal to : This Operator checks if the value is less than or is equal to the other value. This operator is denoted by less than or equal to sign(<=).
  • greater than or equal to : This Operator checks if the value is less than or equal to the other value. This operator is denoted by greater than or equal to sign(>=).
Boolean Operators:

There are three different types of boolean Operators in Arduino. They are:

  • and: This operator is called Logical AND, and it returns a true if both of the given conditions are satisfied. This operator is denoted by And Sign(&&).
  • or: This operator is called Logical OR, it returns a true if either of the two given conditions is satisfied. This operator is denoted by OR(||)
  • not: This operator is called Logical NOT, and it is used to check the reverse condition. This operator is denoted by NOT(!).
Bitwise Operators:
Compound Operators:

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions